[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [FWP] awww, no fun :(



>>>>> "RLS" == Randal L Schwartz <merlyn@stonehenge.com> writes:


  RLS> That's to be able to write loop controls like:

  RLS> sub last_OUTER_if_int { last OUTER; }

  RLS> { local $SIG{INT} = 'last_if_int';

  RLS>   OUTER: while ($some_cond) {
  RLS>     ...
  RLS>     ...
  RLS>     ...
  RLS>     ...
  RLS>   }
  RLS> }

  RLS> There... now we break the loop on int, rather than break the program.

and that can be done with eval/die as well which is designed for things
like that. this escaping a loop using last in a sub is obscure at best
and definitely confusing. the fact that it warns and the eval/die
doesn't is a major reason to use the latter.

uri

-- 
Uri Guttman  ---------  uri@sysarch.com  ----------  http://www.sysarch.com
SYStems ARCHitecture and Stem Development ------ http://www.stemsystems.com
Learn Advanced Object Oriented Perl from Damian Conway - Boston, July 10-11
Class and Registration info:     http://www.sysarch.com/perl/OOP_class.html

==== Want to unsubscribe from Fun With Perl?  Well, if you insist...
==== Send email to <fwp-request@technofile.org> with message _body_
====   unsubscribe