Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re: Which signals are unsafe?

by BrentDax (Hermit)
on Apr 01, 2004 at 23:25 UTC ( [id://341832]=note: print w/replies, xml ) Need Help??


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.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://341832]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others learning in the Monastery: (3)
As of 2024-07-21 18:41 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?
    erzuuli‥ 🛈The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.