perl-modperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Issac Goldstand <mar...@beamartyr.net>
Subject Re: How to extract a parameter
Date Tue, 16 Jan 2007 09:42:55 GMT


Fred Moyer wrote:
>> Issac Goldstand wrote:
>> 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!).

When libapreq2 was being developed, we realized that the learning curve
for the new interfaces (APR::Request::xxx) might be tricky for some
people to get the hang of (especially if they were used to the old
libapreq1 way of doing things), so Apache2::Request was added to make
things simple and as backwards-compatible as possible.  How would you
envision it being simpler than it currently is?

Instead of doing:
my $q=CGI->new;
my $param=$q->param('foo');

One needs to do:
my $req=Apache2::Request->new($r);
my $param=$req->param('foo');

I still fail to see the difficulty...  If someone can think of an even
simpler way, I'd be all for getting it included in future libapreq
releases...

  Issac

Mime
View raw message