I need to handle signals to close some excel applications that my
script open, when the script is killed by another process.
My script is a little bit complex, but I wrote just two very small
scripts to test the kill and signal.
The scripts signal.pl is this one:
map {$SIG{$_} = sub {my $n = shift; print "n=$n\n"}} keys %SIG;
#just in case
$SIG{INT} = sub {my $n = shift; print "n=$n\n"};
print "pid = $$\n";
sleep 1 while(1)
And the second one (kill.pl) is just the following line:
kill ($ARGV[0] => $ARGV[1]);
What I call the second like this:
perl kill.pl INT pid_returned_from_first_script
I expected the signal to be handled by fisrt script, but no matter
what signal I sent, the first script never receives the signal. It
just was killed without any signal handling.
Does anyone know what I am doing wrong here?
Isidro