in reply to Re^2: $ENV{'REQUEST_METHOD'} undefined?
in thread $ENV{'REQUEST_METHOD'} undefined?

use strict; use warnings; use CGI; my $req_meth = CGI->request_method(); my %postInputs = CGI->Vars; ...

Still you haven't answered the most important question: Is the script run as a CGI script? That is, is there a web server that executes it with the CGI protocol?

Perl 6 - links to (nearly) everything that is Perl 6.

Replies are listed 'Best First'.
Re^4: $ENV{'REQUEST_METHOD'} undefined?
by Lamont85 (Novice) on Nov 30, 2009 at 12:38 UTC

    This script, I believe, is not run as a CGI script. I say this because I haven't yet used the CGI module in it. HTML is ouput using templates, and any data is stored into DAT files simply by opening them and writing to them.

    I hope that answers your question.

      Yes, it answers my question. And it explains why $ENV{'REQUEST_METHOD'} is not defined - because nobody defined it. Usually the web server does that, when you run the program as CGI.

      So you're using a script in context it was not made for. The fix is to run it in the right context, which means through a web server as CGI. (Using the CGI is module is only a symptom for a CGI environment, and not necessarily related to it).

        I supose I should back up a bit. This script is invoked by the default page of the site which is as follows. It explicitly sets REQUEST_TYPE to POST.

        <html> <head> <title>Redirecting...</title> </head> <body onload="document.forms['main_loop'].submit();"> <form action="/cgi-bin/index.pl" method="post" name="main_loop"> </form> </body> </html>

        What do you mean by "run as CGI?"

        I understand the benifits of using CGI, but considering the amount of time I have put into this and lack of time I have to complete it, and since I imagine it would take quite a long time to convert the 6000+ lines of code in this script to use CGI, I would like to continue without it. I have plans for a second version of this script and intend to study up and use CGI, but for the time being I need a working version ASAP.

        Thank you again for the help...much appreciated. :)