use strict; use sigtrap 'handler' => \&myhand, 'INT'; sub myhand{ print "\nOutta here $$!\n" }; my $pid = fork(); if ($pid) { print "I am parent $$\n"; for (1 .. 1000000){} kill INT => $pid; print "I am parent $$\n"; } elsif (defined($pid)) { print "I am child $$\n"; while (1){ sleep 1; } } else { print "child was not created\n"; } wait(); print "hi\n";
In reply to Re: •Re: Catching signals
by Anonymous Monk
in thread Catching signals
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |