--- On Tue, 9/23/08, Himanshu <[EMAIL PROTECTED]> wrote:

> From: Himanshu <[EMAIL PROTECTED]>
> Subject: How to extract name/value pairs from the query string?
> To: modperl@perl.apache.org
> Date: Tuesday, September 23, 2008, 9:06 AM
> Hi,
> 
>      What is the recommended module to get the name/value
> pairs from the
> query string.


You could just do this:

my %args = map { my ($k,$v) = split /\=/, $_; unescape($k) => (unescape($v) } 
split /\&/, $r->args;

sub unescape {
  # Try CGI::Simple or something else for an unescape method.
}



> Apache2::RequestRec::args comes close but
> there must be
> something easier to use.

Ha no not really.  Somehow everything else must suffer (usability, debugging, 
intuitiveness, etc) so that we can have a *fast* web programming environment. 
(Yay!)

Doing those kinds of things that nobody ever really does (like, gee, parsing 
form contents) remains something of an oddity in the realm of mod_perl.  
*However* if you need to print "HELLO, WORLD!" almost as fast as a static file 
does...well, we've got it covered!

NOTE:: You could also check out CGI::Apache2::Wrapper on CPAN.  It does 
everything you want, but you have to play with it to get it installed (just 
force install).

Best regards,
John Drago




> 
> sub login_response {
>     my $r = shift;
>     my $args = $r->args();
>     ...
> }
> 
> Thanks,
> Himanshu








      

Reply via email to