in reply to Catching warnings
1. Put a handler in $SIG{__DIE__}. You will get the fatal error message but the program will still die. (Unless you do some extra work. See the perlvar entry on %SIG for details.)
2. Wrap your possible fatality-producing code in an eval. Any fatal error will be put in $@ which you can send to your logging function. For example:
eval { $self->NonExistingFunction(); }; print "FATAL ERROR: $@" if $@;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Catching warnings
by Marcello (Hermit) on Dec 13, 2005 at 18:50 UTC |