Java Mailing List Archive

http://www.apache-httpd.com/

Home » modperl.perl »

lexical scoping under mod perl solution

Erik Aronesty

2009-02-12

Replies: Find Java Web Hosting

Author LoginPost Reply
(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@(protected):
> -------------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');
©2008 apache-httpd.com - Jax Systems, LLC, U.S.A.