> Sorry, I wasn't clear. Let me rephrase. The 'try' helps me determine that
> the following block is going to be subject to exception handlers which will
> immediately follow as siblings of the block. Somewhat as I would look at
> an if...elsif...else construct, it helps me put the block in context as I'm
> reading it and also look ahead fo those handlers. I prefer this to
> discovering a handler as I'm reading and then looking for the enclosing
> block, or coming across an undecorated block and scanning to see if this is
> because it has embedded handlers or is to create a closure, or to use a
> redo, or...
like
eval { SomethingThatDies()};
if $@{
$@ =~ /case1/ and DealWithCase1 and return;
$@ =~ /case2/ and DealWithCase2 and return;
$@ =~ /case3/ and DealWithCase3 and return;
die "Unhandled case $@";
LABEL:
};
$@ gets reset at the next eval. I assume these things
nest appropriately, and $@ starts as null inside an eval
and evalling something inside there that dies does not
affect external ones. Testing....
perl -le 'eval{eval{die "i"};print $@};print "now:$@\nok"'
yup.
- Re: assign to magic name-of-function variable instead of &... Tony Olekshy
- Re: assign to magic name-of-function variable instead... Glenn Linderman
- Re: assign to magic name-of-function variable instead of &... Bart Lateur
- Re: assign to magic name-of-function variable instead of &... Johan Vromans
- Re: assign to magic name-of-function variable instead... John Porter
- Re: assign to magic name-of-function variable instead... Ariel Scolnicov
- Re: assign to magic name-of-function variable instead of &... John Porter
- Re: assign to magic name-of-function variable instead of &... Peter Scott
- Re: assign to magic name-of-function variable instead of &... John Porter
- Re: assign to magic name-of-function variable instead of &... Peter Scott
- Re: assign to magic name-of-function variable instead... David L. Nicol
- Re: assign to magic name-of-function variable instead of &... John Porter
- Re: assign to magic name-of-function variable instead of &... David L. Nicol
- Re: assign to magic name-of-function variable instead of &... Nicholas Clark
- Re: assign to magic name-of-function variable instead of &... Branden
