anand kumar 写道:
Hi all,
I would like to know if there is any possibilty to handle a situation where
in while executing a perl script if i press a Control-C (or terminate the
execution explicitly) then my code should be in a position to handle it and
display a predefined message(or specifically execute predefined code for
cleanup) and then actually exit the code execution.
Thanks in advance for the help.
regards
Anand
You may want something like this:
$SIG{TERM} = sub { do_sth_of_yours; exit; };
It means you re-define the signal handler for SIGTERM.
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/