Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
my script will be called through the linux env command, which sets environment variables, then applies them to the script:
so these are then accessible in perl through the %ENV hash. the important one here is $ENV{QUERY_STRING}, because I'd like to parse it with the CGI module, but because its delimited with plus signs instead of ampersands, CGI doesnt seem to like that. it stores it all as one name=value pair (interpreting the + delimiters as spaces):env REQUEST_METHOD=GET DATA_SOURCE=cmdline QUERY_STRING=DBNAME=mydatab +ase+SF=dbfield+SV="search_string"+HEAD=none+TAIL=none+TEMPLATE_DIR=te +mplates/path/+CONTENT_TYPE=none /home/evan/test.pl
so, my question (for now) is, can I tell CGI to interpret this string as not URL-encoded, and to use the + as a delimiter? or is there a Better Way?use CGI; use Data::Dumper; my $q = new CGI( $ENV{QUERY_STRING} ); print Dumper( $q->param('DBNAME') ); # this outputs: $VAR1 = 'mydatabase SF=dbfield SV="search_string" HEAD=none TAIL=none +TEMPLATE_DIR=templates/path/ CONTENT_TYPE=none';
Edited by davorg: Fixed code tags to allow line to split
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: using CGI with different delimiter than '&'
by davorg (Chancellor) on Jul 20, 2006 at 14:46 UTC | |
|
Re: using CGI with different delimiter than '&'
by wazoox (Prior) on Jul 20, 2006 at 15:15 UTC | |
|
Re: using CGI with different delimiter than '&'
by duff (Parson) on Jul 20, 2006 at 15:59 UTC | |
by EvanK (Chaplain) on Jul 21, 2006 at 18:05 UTC | |
|
Re: using CGI with different delimiter than '&'
by Anonymous Monk on Jul 20, 2006 at 14:46 UTC |