On Jan 16, 2007, at 4:07 AM, Fred Moyer wrote:
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.
As a rule of thumb , i believe in this:
If you are developing code that will only run under mod_perl, use
libapreq ( ie : using the handler + api functionality and not simple
code caching )
If you are developing code that you may want to run in another
environment , use CGI ( be it a standalone perl server, fcgi, etc )
In terms of numbers:
http://modperlbook.org/html/ch13_02.html
its old.. libapreq is probably a bit faster now. performance
difference between the two is negligble for a handful of params, but
CGI performace degrades signficantly faster than libapreq with each
additional argument.
i just use libapreq. i'd love to figure out a compatibility layer
one day , and just be able to abstract all my code from mod_perl so
it *could* run under fcgi or something if need be. i severely doubt
that will ever happen, but it is a bit disconcerting to me at times
that certain things I have are locked into Apache+mod_perl , and not
just perl. Not that I want to switch, its just that not having the
option to easily switch can lead to a little anxiety.
// Jonathan Vanasco
| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - -
| FindMeOn.com - The cure for Multiple Web Personality Disorder
| Web Identity Management and 3D Social Networking
| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - -
| RoadSound.com - Tools For Bands, Stuff For Fans
| Collaborative Online Management And Syndication Tools
| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - -