in reply to Which signals are unsafe?
$SIG{__WARN__} isn't a real signal, so it's safe. I believe that all signals have been safe since 5.8.
Have you looked at the Carp module? It can be used with $SIG{__WARN__} to print backtraces. Perhaps you could do something like this:
use Carp 'cluck'; $SIG{__WARN__}=\&cluck; open(STDERR, "|tee -a Warnings.log") or die "Can't open STDERR to tee: + $!";
It's not exactly the same as what you have; most notably, all STDERR output would go to Warnings.log, not just warnings. Fixing this is left as an exercise for the reader. ;^)
If nothing else, Carp's longmess sub can handle the backtracing for you.
=cut
--Brent Dax
There is no sig.
|
---|
In Section
Seekers of Perl Wisdom