perl-modperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Perrin Harkins" <per...@elem.com>
Subject Re: Reducing memory usage using fewer cgi programs
Date Sun, 26 Oct 2008 03:43:06 GMT
On Sat, Oct 25, 2008 at 7:32 AM, André Warnier <aw@ice-sa.com> wrote:
> And they do "remember" some things between consecutive runs of scripts
> or modules.  That is usually undesirable, because it can give nasty
> errors : a variable that you declare with "my $var" and that you expect
> to be "undef", might not be, if a previous run of the same script or
> module (in the same Apache child) has left something in it.

Nit pick: a "my" variable is lexically scoped and will not retain its
value between requests unless your code is written in a way that makes
a closure around it, e.g.

my $foo = 7;

sub bar {
    print $foo;
}

- Perrin

Mime
View raw message