in reply to Re: Are There Error Handlers in Perl?
in thread Are There Error Handlers in Perl?
This is exactly the type of things that I think you should do with eval {}. If you are going to be throwing exceptions then you need to be able to nest your exception catchers. This is exactly how eval {} works.
No matter how tricky you get with saving and queueing $SIG{__DIE__} handlers, you'll never get a $SIG{__DIE__} handler to unwind part of the stack so the third handler up can deal with an exception that the inner two handlers couldn't continue past.
And all you need is one person somewhere setting $SIG{__DIE__} without following your queueing method and you lose.
I get the feeling that $SIG{__DIE__} is much more popular than eval {}. I'm not sure if this is due to wording in the documentation or an overblown fear of "slow eval".
- tye (and I'll see an end to $SIG{__DIE__} and File::FindBin yet!)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re (tilly) 3: Are There Error Handlers in Perl?
by tilly (Archbishop) on Jan 20, 2001 at 14:26 UTC |