Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re: Ignoring/Trapping the DIE signal

by ikegami (Patriarch)
on Jun 15, 2006 at 00:40 UTC ( [id://555388]=note: print w/replies, xml ) Need Help??


in reply to Ignoring/Trapping the DIE signal

I'd prefer a soln that doesn't involve eval'ing everything, as it's not only messy (lots of this type of code to fix), but also these daemons need to be as fast as reasonably possible.

eval BLOCK (as opposed to eval EXPR) does add any slowdown that an alternative wouldn't add. eval BLOCK is like try BLOCK in other languages (whereas eval EXPR does run-time compilation of Perl code).

The only alternative of which I know is $SIG{__DIE__}

Replies are listed 'Best First'.
Re^2: Ignoring/Trapping the DIE signal
by chrism01 (Friar) on Jun 15, 2006 at 01:15 UTC
    I tried $SIG{__DIE__} variations as you can see in my code above, but it seems to die eventually anyway, as shown.
    I've also tried adding an 'eval {};' around the code above ie 'eval {' just after the $SIG{__DIE__} = .. and then end the block ie '};' at the end of the script, but it fails in almost exactly the same way ie prints pretty much the same msgs, prints 'SIGDIE caught', then dies anyway... grrrr
      __DIE_ handlers are different from other handlers. For one, you cannot "catch it", if you try it will still fly away! What is the purpose of a __DIE__ handler then? There are two reasons:

      1. to alter the die message,
      2. to goto a subroutine (this time with the handler disabled). But your days are numbered: receive another die and you are dead, once the subroutine finishes your life is also finished.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others chilling in the Monastery: (5)
As of 2024-04-19 15:04 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found