Roget's says: "use fatal for something which has caused someone's death; use lethal for something which is capable of killing someone."
So maybe use lethal; makes more sense.
{ use lethal qw[ ... ], sub { if( $^exception eq 'something' ) { ## deal with it ... return; } else { die $^exception; ## re-throw } }; ... ## protected code here }
Ie. The module would save the current $SIG{__DIE__} handler and install a the users callback and restore the original when leaving scope or when no lethal; is seen.
I'm not sure all of that is possible, never mind how to do it. But I like the idea of it.
In reply to Re: RFC: Lexical Fatal.pm for Perl 5.10
by BrowserUk
in thread RFC: Lexical Fatal.pm for Perl 5.10
by pjf
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |