> Is there a way to trap runtime errors, and, say, output them to a log file
> before perl dies?

Often something as simple as this will do the trick:

eval {
    ... # Some code that may call die()
};

logmsg($@) if $@; # logmsg() is defined elsewhere to output
                  # its argument to a log file.

Or you could define closures for $SIG{__WARN__} and/or $SIG{__DIE__} that
get called when warn() or die() are called, respectively, e.g.:

local $SIG{__WARN__} = sub { logmsg(shift) };

HTH,

David

> Keary Suska
> Esoteritech, Inc.
> "Leveraging Open Source for a better Internet"

Reply via email to