Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change

Re^7: bad die behaviour?

by nimdokk (Vicar)
on Sep 10, 2007 at 13:58 UTC ( #638077=note: print w/ replies, xml ) Need Help??

in reply to Re^6: bad die behaviour?
in thread bad die behaviour?

You might want to consider using $SIG{__DIE__} instead of the FatalError subroutine. Put what you are doing in the FatalError into the subroutine for the DIE signal handler, evaluate $? (instead of $!) before die'ing.

Something like:

$SIG{__DIE__}=sub{ print STDERR "I'm Dyin!: \n"; }; some_command; $error_code=$?>>8; print "Finished running some_command"; die if $error_code > 0;

Comment on Re^7: bad die behaviour?
Download Code

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (5)
As of 2015-11-26 01:21 GMT
Find Nodes?
    Voting Booth?

    What would be the most significant thing to happen if a rope (or wire) tied the Earth and the Moon together?

    Results (695 votes), past polls