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

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.

  • Comment on Re^4: $ENV{'REQUEST_METHOD'} undefined?

Replies are listed 'Best First'.
Re^5: $ENV{'REQUEST_METHOD'} undefined?
by moritz (Cardinal) on Nov 30, 2009 at 12:54 UTC
    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. :)

        The typical data flow for a perl script serves a web page looks like this:
         Web browser  ---->  Web server ----->  +--------+
                      HTTP               CGI    | Your   |
                                                | Perl   |
                                                | script |
         Web browser <----- Web server <------  +--------+
        

        CGI refers to a protocol for exchanging data between the web server and your perl script. (It is not the CGI perl module).

        There are other methods for communicating between a perl script and a web server, popular ones include FastCGI and mod_perl.

        So, for answering the question whether your program runs a CGI script you have to look into the configuration of your web server. Using the CGI Perl module doesn't change that, it just makes your program simpler.