in reply to lighter alternative to CGI.pm
I personnally wouldn't use the next code and strongly advice to create a better running server...
But, FYI, you can parse the parameters manually. Depending on the complexity, you could use this.
If you use this 'wannahave a Big Ball of Mud solution' (i love that name) make sure you check the parameters for security problems.
my $input; if ($ENV{REQUEST_METHOD} eq 'GET'){ $input = $ENV{QUERY_STRING}; } else { read(STDIN,$input,$ENV{CONTENT_LENGTH}); } foreach( split(/&/,$input)){ $_ =~ tr/+/ /; my ($name,$value) = split(/=/,$_,2); $name =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C",hex($1))/eg; $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C",hex($1))/eg; if($param{$name}) { $param{$name}.= ",$value"; } else { $param{$name} = $value; } print "Found $name = $value\n"; }
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Re: lighter alternative to CGI.pm
by perrin (Chancellor) on Aug 30, 2002 at 12:54 UTC |
In Section
Seekers of Perl Wisdom