Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

I'm not sure if this is a fault in my Perl or in my mod_perl config, but POSTing isn't working. Here is relevant info:
<Directory /path/> SetHandler perl-script PerlHandler Apache::Registry Options +ExecCGI </Directory> CONTENT_TYPE -> application/x-www-form-urlencoded GATEWAY_INTERFACE -> CGI-Perl/1.1 MOD_PERL -> mod_perl/1.24_01 REQUEST_METHOD -> POST CONTENT_LENGTH -> 62 QUERY_STRING -> blahblah

The information via my form is nowhere to be found. I tried using ->Vars from CGI and that didn't work. I commented out all that stuff and just looped through %ENV and my post content wasn't there at all. Am I doing something wrong?

Replies are listed 'Best First'.
Re: mod_perl is not liking POST
by fglock (Vicar) on Sep 01, 2002 at 22:58 UTC

    It looks ok to me. What is your html form like? Does the script work without mod_perl? Isn't  blahblah what you are POSTing?

Re: mod_perl is not liking POST
by Anonymous Monk on Sep 02, 2002 at 01:22 UTC
    Lemme guess, you are doing your own form handling rather than using CGI? And are wondering why the environment variables don't have the data?

    Surprise! That is one of the reasons why you aren't supposed to roll your own. On a POST the data does not come in in the environment (which is limited in size). It has to be read from the appropriate socket.

    Try this snippet and see if it doesn't work a little better...

    use CGI qw(:standard); # time passes my $param_value = param('param_name');

      Nice guess, but the poster said he tried using CGI::Vars(). I'm more concerned about there being a 'query string' value. By default, CGI.pm doesn't read both GET and POST content.

Re: mod_perl is not liking POST
by Flexx (Pilgrim) on Sep 02, 2002 at 09:35 UTC