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

Re^2: How to catch 'die' signal - CONVERSE case of #811295

by puterboy (Scribe)
on Dec 07, 2009 at 03:17 UTC ( #811414=note: print w/ replies, xml ) Need Help??


in reply to Re: How to catch 'die' signal - CONVERSE case of #811295
in thread How to catch 'die' signal - CONVERSE case of #811295

Thanks to the two previous posters for suggesting an END block. As a long-time perl dilettance, I was not aware of such usage.

I then noticed though that END block doesn't capture things like SIGINT/SIGTERM.

To capture those, I had to add the following line of code:

$SIG{INT} = $SIG{TERM} = $SIG{HUP} = sub { exit; };
Is this the correct way to do it?


Comment on Re^2: How to catch 'die' signal - CONVERSE case of #811295
Download Code
Re^3: How to catch 'die' signal - CONVERSE case of #811295
by ikegami (Pope) on Dec 07, 2009 at 04:53 UTC
    By default, the OS unloads the program in response to those signals. That looks like a good solution to me.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (7)
As of 2014-12-21 21:16 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (108 votes), past polls