You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Alex Harper <ah...@broadjump.com> on 2001/10/01 23:16:34 UTC

CGI.pm params not being cleared?

I'm sure this is a FAQ somewhere, but I'm not finding it...

In our switch to mod_perl we're seeing two problems with CGI.pm (version
2.752). I'm uncertain if they are related or not.

1. Across multiple requests to a single script, the params are not
cleared. The first params sent to that script (per Apache server) are
wedged permanently. It doesn't seem to matter if the params came from
GET or POST.

2. Despite precompiling CGI.pm using its compile method in our mod_perl
startup, we constantly see warning for CGI.pm subroutine redefinitions
("start_html", etc.)

We precompile CGI.pm in our mod_perl startup as follows (from the
guide):
use CGI qw(-compile :all); 

In the script in question params are read like so:
use CGI;
$cgi = new CGI;
if ($cgi->param("dataaction") eq "whatever") {
	# Does something useful
}

Some of our modules also create (and destroy) CGI objects, but none of
them are global, and I can't see any way for the script to be getting
confused with a module's copy (the script itself does not user those
modules, though they are precompiled during mod_perl startup).

Obviously I must be doing something wrong... Any suggestions?

Thanks for any assistance, 

Alex


--
Alex Harper
Configuration Management
aharper@broadjump.com
"Use whatever you think of first" -- Larry Wall 

Re: CGI.pm params not being cleared?

Posted by "Ken Y. Clark" <kc...@logsoft.com>.
On Mon, 1 Oct 2001, Alex Harper wrote:

> Date: Mon, 1 Oct 2001 16:16:34 -0500
> From: Alex Harper <ah...@broadjump.com>
> To: modperl@apache.org
> Subject: CGI.pm params not being cleared?
>
> I'm sure this is a FAQ somewhere, but I'm not finding it...
>
> In our switch to mod_perl we're seeing two problems with CGI.pm (version
> 2.752). I'm uncertain if they are related or not.
>
> 1. Across multiple requests to a single script, the params are not
> cleared. The first params sent to that script (per Apache server) are
> wedged permanently. It doesn't seem to matter if the params came from
> GET or POST.
>
> 2. Despite precompiling CGI.pm using its compile method in our mod_perl
> startup, we constantly see warning for CGI.pm subroutine redefinitions
> ("start_html", etc.)
>
> We precompile CGI.pm in our mod_perl startup as follows (from the
> guide):
> use CGI qw(-compile :all);
>
> In the script in question params are read like so:
> use CGI;
> $cgi = new CGI;
> if ($cgi->param("dataaction") eq "whatever") {
> 	# Does something useful
> }

Perhaps you ought to declare "$cgi" with a "my"?

> Some of our modules also create (and destroy) CGI objects, but none of
> them are global, and I can't see any way for the script to be getting
> confused with a module's copy (the script itself does not user those
> modules, though they are precompiled during mod_perl startup).
>
> Obviously I must be doing something wrong... Any suggestions?

Well, despite CGI.pm's overall usefulness, is there any reason you
don't use Apache::Request?  It's definitely faster.

ky