in reply to RFC: Lexical Fatal.pm for Perl 5.10
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.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: RFC: Lexical Fatal.pm for Perl 5.10
by pjf (Curate) on Mar 09, 2008 at 08:47 UTC | |
by BrowserUk (Patriarch) on Mar 09, 2008 at 09:40 UTC |