perl-modperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "JupiterHost.Net" <>
Subject Re: Problems with PerlRun
Date Tue, 31 Jan 2006 00:32:13 GMT

Patrick Kennedy wrote:
> With PerlRun, after the script has run the name space is supposed
> to be flushed of all variables and subroutines. Right? This doesn't seem
> to be happening with my setup. I'm getting incorrect output, based on
> previous executions of the script. Here's a simple example:
> #!/usr/bin/perl -w
> use strict;
> use CGI;
> my $query = new CGI;

> my $x = $query->param('x') || '0';
> print "Content-type: text/html\n\n";

Why not $query->header(); since you've already got CGI and a CGI object?

Its probably an old CGI module. I'm basing that on several things:

a) "new CGI" is old
b) -w is "old" sort of (use warnings)
c) bad naming conventions is old ($query ? is this sql ? no its cgi so 
call it $cgi ;p you'll thank yourself later)
d) the header thing mentioned above
e) the behavior of the script with the random values


use strict;
use warnings;

use CGI;

my $cgi = CGI->new();
print $cgi->header();

print "<b>CGI VERSION: $CGI::VERSION</b><br />\n";

for($cgi->param('x')) {
    print "x is $_<br />\n";

Make sure the version it has it the latest on CPAN and upgrade if needed 
and try it again :)


View raw message