You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Perrin Harkins <pe...@elem.com> on 2004/10/14 20:59:23 UTC

Re: MP1: Odd localized variable behavior

On Thu, 2004-10-14 at 14:13, Tom Murphy wrote:
> According to how I understand perl/mod_perl workings, the actual address of
> the SV shouldn't change regardless of the number of invocations of the
> script ( assuming the file modification time doesn't change ).  Upon the
> second invocation it looks like the sub has retained the original SV and the
> file level usage has created a new SV.  Oddly,  after the second invocation,
> none of the address change.
> 
> Any ideas?

It's just creating a closure.  That's what happens when you reference a
lexical declared in a higher-level scope from inside a sub.  If you were
not intending to create a closure, you need to pass the variable to the
sub instead.

- Perrin


-- 
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html