j*c 发帖数: 97 | 1 does perl have any mechanism to handle exceptions? I mean if my script receive
a "kill" siginal, can I have it run some exception handling codes before exit?
thanks. | o***z 发帖数: 133 | 2 use POSIX;
then use something like sigaction to install a signal handler
【在 j*c 的大作中提到】 : does perl have any mechanism to handle exceptions? I mean if my script receive : a "kill" siginal, can I have it run some exception handling codes before exit? : thanks.
| D**e 发帖数: 10169 | 3 yes. you can override the default signal action by supplying your own sub
routine. the name of the signals are defined in signal.h.
change %SIG, set the value corresponding to the signal you want to catch to
the name of your won sub-routine.
receive
exit?
【在 j*c 的大作中提到】 : does perl have any mechanism to handle exceptions? I mean if my script receive : a "kill" siginal, can I have it run some exception handling codes before exit? : thanks.
|
|