hackdaddy has asked for the wisdom of the Perl Monks concerning the following question:
try { do_some_stuff(); die "error!" if $condition; throw Error::Simple -text => "Oops!" if $other_condition; } catch Error::IO with { my $E = shift; print STDERR "File ", $E->{'-file'}, " had a problem\n"; } except { my $E = shift; my $general_handler=sub {send_message $E->{-description}}; return { UserException1 => $general_handler, UserException2 => $general_handler }; } otherwise { print STDERR "Well I don't know what to say\n"; } finally { close_the_garage_door_already(); # Should be reliable }; # Don't forget the trailing ; or you might be surprised
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Exception Handling using Error.pm
by perrin (Chancellor) on May 09, 2002 at 18:17 UTC | |
|
Re: Exception Handling using Error.pm
by P0w3rK!d (Pilgrim) on May 10, 2002 at 17:33 UTC | |
|
Re: Exception Handling using Error.pm
by hackdaddy (Hermit) on May 10, 2002 at 23:58 UTC |