Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re: Problem with signal handler

by ChOas (Curate)
on Nov 21, 2007 at 11:46 UTC ( #652107=note: print w/ replies, xml ) Need Help??


in reply to Problem with signal handler

Hi! Just keep track in your parent to see if/how many times ctrl-c was pressed: like :

[...] my $pid = fork; my $dontDie = 2; [...]
And then in your Interrupt routine:
$SIG{INT} = sub { die "This is the end" unless --$dontDie; warn "Sending sig INT to child PID $pid"; kill 'INT' => $pid; };
(This is just a quick fix, do please pay close attention to jbert's comments)

GreetZ!,
    ChOas

print "profeth still\n" if /bird|devil/;


Comment on Re: Problem with signal handler
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (8)
As of 2015-07-06 08:21 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (70 votes), past polls