in reply to Re: $ENV{'REQUEST_METHOD'} undefined?
in thread $ENV{'REQUEST_METHOD'} undefined?
I don't quite understand. I have updated the code (to the best of my ability) to use the CGI module. Perhaps, I am leaving something out. Keep in mind that the actual script will accept any number of parameters through an HTML form.
#!C:\Perl\bin\perl.exe use strict; use warnings; use CGI; my $req_meth = CGI->request_method(); sub readPostInput() { my (%searchField, $buffer, $pair, @pairs); if ($req_meth eq 'POST') { read (STDIN,$buffer,$ENV{'CONTENT_LENGTH'}); @pairs = split(/&/, $buffer); foreach $pair (@pairs) { my ($name, $value) = split(/=/, $pair); $value =~ tr/+/ /; $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/e +g; $name =~ tr/+/ /; $name =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg +; $searchField{ $name } = $value; } } } my %postInputs = readPostInput(); print "Content-type: text/html\n\n"; print "Complete :: $req_meth";
After these changes I still receive the same error.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: $ENV{'REQUEST_METHOD'} undefined?
by moritz (Cardinal) on Nov 30, 2009 at 12:21 UTC | |
by Lamont85 (Novice) on Nov 30, 2009 at 12:38 UTC | |
by moritz (Cardinal) on Nov 30, 2009 at 12:54 UTC | |
by Lamont85 (Novice) on Nov 30, 2009 at 13:08 UTC | |
by moritz (Cardinal) on Nov 30, 2009 at 14:01 UTC |