Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: Can't catch signals after an exec?

by sh1tn (Priest)
on Mar 19, 2005 at 10:47 UTC ( [id://440905]=note: print w/replies, xml ) Need Help??


in reply to Can't catch signals after an exec?

The signals are catched each time, not only once.
With exec() this program replaces itself with itself($0) thus starting a fresh copy:
$sub = sub { exec "perl $0" }; $SIG{INT} = $sub; $SIG{USR1} = $sub; $|++; print (++$counter), sleep 1 while 1 # E:\kod>exec.pl ###>Ctrl+C # 1234567 # E:\kod>123 ###>Ctrl+C # E:\kod>123 ###>Ctrl+C # E:\kod>123 ###>Ctrl+C # E:\kod>1234567
obviously useless code ... my mistake to take ones time ...


Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others taking refuge in the Monastery: (3)
As of 2024-04-20 01:43 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found