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.
In reply to Re^2: $ENV{'REQUEST_METHOD'} undefined?
by Lamont85
in thread $ENV{'REQUEST_METHOD'} undefined?
by Lamont85
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |