develooper Front page | perl.perl5.porters | Postings from April 2001

Re: [ID 20010412.002] tie() magic upsets stack (can't last() outsideof block)

Thread Previous | Thread Next
From:
Rick Delaney
Date:
April 12, 2001 15:10
Subject:
Re: [ID 20010412.002] tie() magic upsets stack (can't last() outsideof block)
Message ID:
3AD62AEE.F89768EC@home.com
jpinyan@sushi.riskgrades.com wrote:
> 
[snip]
> sub STORE {
>   my ($self, $val) = @_;
>   local $_ = $self->{VAL} = $val;
>   $self->{CODE}->() ? $_ : last;   # <-- bad news
> }
[snip]
> When I run this code, I'm told I can't call last() from outside a loop
> block.

That is only a warning.  Your code should still work as you expect.  One
other way to suppress the warning (not mentioned on fwp) would be to put

    no warnings 'exiting';

right before the line with "last".

-- 
Rick Delaney
rick.delaney@home.com

Thread Previous | 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