in reply to Passing Arguments With Perl/Cgi
(It's very important to know how to do it yourself.)
Here's my way to do it. Note how it catches invalid pairs.
if ($ENV{'REQUEST_METHOD'} eq "GET") { for (split(/\&/, $ENV{'QUERY_STRING'}) { if (($name, $value) = /(.*)=(.*)/) { ## Normal $value =~ ## Unescape $value here } else { ## Abnormal, no "equal"! $name =$_; $value=0; } $name =~ ## unescape $name here }
Update:Yes, I know, you should just use CGI. The above code is merely for educational purposes, please use CGI for any "real" code. :)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Passing Arguments With Perl/Cgi
by Anonymous Monk on Feb 19, 2009 at 15:19 UTC | |
by Corion (Patriarch) on Feb 19, 2009 at 15:22 UTC |