On Apr 12, Rick Delaney said: >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, that is not a warning. A warning is when you use last() to get out of a loop while in a subroutine. This message is a fatal error: Can't "last" outside a loop block at ensure line 23. It occurs because when Perl gets to STORE via tie() magic, it "forgets" itself. -- Jeff "japhy" Pinyan japhy@pobox.com http://www.pobox.com/~japhy/ Are you a Monk? http://www.perlmonks.com/ http://forums.perlguru.com/ Perl Programmer at RiskMetrics Group, Inc. http://www.riskmetrics.com/ Acacia Fraternity, Rensselaer Chapter. Brother #734Thread Previous | Thread Next