On Apr 12, Rick Delaney said: >Jeff Pinyan wrote: >> >> sub STORE { >> my ($self, $val) = @_; >> local $_ = $self->{VAL} = $val; >> $self->{CODE}->() ? $_ : last; > >Try changing last to die and ... > >> } >> >> package main; >> use strict; >> >> sub ensure (&@) { >> my ($cref, $obj, $loop) = @_; >> tied($$obj)->{CODE} = $cref; >> { $loop->(); redo } > > eval { { $loop->(); redo } }; > >> } Wow. Thanks, Rick. That's really quite simple, but ingenious. -- 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 #734 ==== Want to unsubscribe from Fun With Perl? Well, if you insist... ==== Send email to <fwp-request@technofile.org> with message _body_ ==== unsubscribe