perl-modperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Erik Aronesty <earone...@gmail.com>
Subject lexical scoping under mod perl solution
Date Thu, 12 Feb 2009 15:52:38 GMT
(A solution would be to force all "my" varialbes at the file scope to
be "our" and then put the cgi in an anonymous package:)

On Thu, Feb 12, 2009 at 10:33 AM, Erik Aronesty <earonesty@gmail.com> wrote:
> -------------8<---------- Start Bug Report ------------8<----------
> 1. Problem Description:
>
> It's well known that file-scoped lexicals don't work intuitively in
> CGI programs under mod_perl.
>
> When mod_perl calls the same CGI program twice, file-scoped lexicals
> are not rebound.
>
> Some people are aware of this, random posts to newsgroups will attest,
> but this is not documented well enough.
>
> Create a CGI as below, and run it many times, assigning different
> CGI::param('foo') values to $x.
> Lowering the number of children spawned in Apache will reduce the
> number of times needed
> to run the script in order to see the problem.
>
> # this program sometimes prints old values for foo, but only under mod_perl!
>
>  use CGI;
>  my $x =CGI::param('foo');

Mime
View raw message