> 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.

Reply via email to