perl-modperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bill Moseley <mose...@hank.org>
Subject PerlSetupEnv and CGI.pm
Date Fri, 04 Jun 2004 18:49:46 GMT
With PerlSetupEnv OFF $cgi->param('foo') returns undef.  I'm sure this
is suppose to work, so I'm wondering what I'm doing wrong.

CGI.pm 3.04, mod_perl 1.29

Here's a test config with a small handler:


    ErrorLog error_log
    PidFile  httpd.pid
    Listen *:5000
    #PerSetupEnv Off

    <perl>
        package test;
        use CGI;
        use Data::Dumper;
        sub handler {
            my $cgi = CGI->new;
            print $cgi->header('text/plain');
            print 'Param "foo" is [', $cgi->param('foo') || 'undefined', "]\n";
            print Dumper \%ENV;
            return Apache::Constants::OK();
        }
    </perl>

    NameVirtualHost *:5000
    <VirtualHost *:5000>
        DocumentRoot /home/moseley/apache
        ServerName localhost

        <Location />
                SetHandler  perl-script
                PerlHandler test
        </Location>

    </VirtualHost>

Now, this works:

$ /usr/sbin/apache-perl -d $(pwd) -f $(pwd)/testcgi.conf -X &

$ GET http://localhost:5000/?foo=bar
Param "foo" is [bar]
$VAR1 = {
          'SCRIPT_NAME' => '',
          'SERVER_NAME' => 'localhost',
          'SERVER_ADMIN' => '[no address given]',
          'PATH_INFO' => '/',
          'HTTP_CONNECTION' => 'TE, close',
          'REQUEST_METHOD' => 'GET',
          'SCRIPT_FILENAME' => '/home/moseley/apache',
          'SERVER_SOFTWARE' => 'Apache/1.3.31 (Debian GNU/Linux) PHP/4.3.4 mod_perl/1.29',
          'HTTP_TE' => 'deflate,gzip;q=0.3',
          'QUERY_STRING' => 'foo=bar',
          'REMOTE_PORT' => '34770',
          'HTTP_USER_AGENT' => 'lwp-request/2.06',
          'SERVER_SIGNATURE' => '',
          'SERVER_PORT' => '5000',
          'REMOTE_ADDR' => '127.0.0.1',
          'SERVER_PROTOCOL' => 'HTTP/1.1',
          'PATH' => '/home/moseley/bin:/usr/local/bin:/usr/bin:/bin:/usr/bin/X11:/usr/games',
          'REQUEST_URI' => '/?foo=bar',
          'GATEWAY_INTERFACE' => 'CGI-Perl/1.1',
          'SERVER_ADDR' => '127.0.0.1',
          'DOCUMENT_ROOT' => '/home/moseley/apache',
          'PATH_TRANSLATED' => '/home/moseley/apache/',
          'HTTP_HOST' => 'localhost:5000',
          'UNIQUE_ID' => 'QMDDXMCoAQIAAE8dAak',
          'MOD_PERL' => 'mod_perl/1.29'
        };

Now with PerlSetupEnv Off the parameter doesn't make it.


moseley@bumby:~/apache$ GET http://localhost:5000/?foo=bar
Param "foo" is [undefined]
$VAR1 = {
          'PATH' => '/home/moseley/bin:/usr/local/bin:/usr/bin:/bin:/usr/bin/X11:/usr/games',
          'GATEWAY_INTERFACE' => 'CGI-Perl/1.1',
          'MOD_PERL' => 'mod_perl/1.29'
        };










-- 
Bill Moseley
moseley@hank.org


-- 
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html


Mime
View raw message