
jdrago_999 at yahoo
Sep 23, 2008, 9:32 AM
Post #3 of 8
(1208 views)
Permalink
|
|
Re: How to extract name/value pairs from the query string?
[In reply to]
|
|
--- On Tue, 9/23/08, Himanshu <himanshu.garg [at] gmail> wrote: > From: Himanshu <himanshu.garg [at] gmail> > Subject: How to extract name/value pairs from the query string? > To: modperl [at] perl > 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
|