develooper Front page | perl.perl5.porters | Postings from August 2005

[perl #7615] (if|unless) ( local ... ) not undone

Thread Next
From:
Steve Peters via RT
Date:
August 26, 2005 11:10
Subject:
[perl #7615] (if|unless) ( local ... ) not undone
Message ID:
rt-3.0.11-7615-119942.6.56470973313098@perl.org
> [mjtg@cam.ac.uk - Fri Aug 26 09:47:17 2005]:
> 
> Steve Peters wrote
> > This behavior has been fixed in bleadperl by not allowing it.  
> > 
> > > ./perl rt_7615.pl
> > Can't localize lexical variable $a at rt_7615.pl line 4.
> 
> No it hasn't.    I suspect you did the wrong test  -  what's that
> "lexical" doing in the error message?
> 
> When I try
> 
> perl5.8.6 -w
> $a = 10;
> if (local $a = 1){
> }
> print $a; # Should be 10, not 1
> __END__
> Found = in conditional, should be == at - line 2.
> 1
> 
> the bug is still present.
> 
> I presume this is another manifestation of the fact that a conditional
> involves *two* scopes, one including the condition and one not.
> Perl conflates them, with unfortunate results.
> 
> I presume the resaon for conflating them is efficiency.
> 
> 

Sorry, a C<my> crept into my code I was using for testing.  So, it
appears at least lexical globals are fixed in blead, although
non-lexicals are still as broken as before.  Ticket re-opened.

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About