Issac Goldstand wrote:
Issac Goldstand wrote:
Jonathan Vanasco wrote:
On Jan 14, 2007, at 6:45 PM, Fred Moyer wrote:
But it's really much easier to use CGI :)
There's also libapreq
OK - so out of the corner of my eye, I saw the link again as the
previous mail was being copied to my sent-mail and noticed that it said
RequestRec::args and not Request::args. So I put my foot in my mouth :-)
As Jonathan correctly said, there's also libapreq:
http://httpd.apache.org/apreq/docs/libapreq2/modules.html
Boy, I'm on a roll this morning. The "previous email" ended up going to
Jonathan only and not to the entire list.
The important part of it [other than me incorrectly stating that
http://perl.apache.org/docs/2.0/api/Apache2/RequestRec.html#C_args_ was
a link to libapreq :-)] was:
I personally never liked using CGI with mod_perl; if I'm going through
the trouble of writing optimized handlers to make my application that
much faster, why use a pure-perl solution that needs to do full parsing
in perl-land, when a lighter-weight C-based alternative is available
that takes full advantage of Apache's internal I/O handling inside the
server already?
So it's a bit of a learning curve. So what? You learned mod_perl's ins
and outs already - libapreq is significantly easier to grasp IMHO.
I agree it's much more powerful, and it is my power tool of choice :)
In the original context of the question though, the poster was asking
how to grab the the query string arguments. In that situation where
someone is not familiar with the basic operations of request parameter
handling, I would recommend CGI because it's a lot easier to get the
desired result quickly, which I think is important for someone learning
modperl. CGI is installed on most systems, and while that extra speed
from libapreq is nice, I've seen the libapreq install trip up beginners
(and a few experts from time to time, including myself!).
I'm working on a project right now where I'm optimizing some request
handlers which use CGI under modperl. I'm using Apache::DProf to
profile the handlers, and the request parameter handling calls under CGI
are a significant component of the processing time (haven't profiled the
memory distribution). I'm planning to use libapreq to speed up the
handlers - I'll ask for permission to post the results. I know it will
be a lot faster but it should be interesting to see the numbers.