Pragma to enable simple signal handling. Provides two signal handlers that can be installed, or you can install your own handler; also provides options to specify which signals to trap. Ignores requests to trap signals not used in your system's architecture.
use sigtrap; # initialize default signal handlers use sigtrap qw(die normal-signals); use sigtrap 'handler' => \handlername, 'normal-signals'; use sigtrap qw(handler handlername normal-signals stack-trace error-signals);
Used to specify which handler is to be installed and used for signals installed after the handler:
Installs handler that
dies with a message indicating what signal
Installs your handler
Default signal handler. Outputs stack trace to STDERR and tries to dump core.
You can specify your own list of options:
or use one of the following built-in option lists:use sigtrap qw(BUS SEGV PIPE ABRT);
Signals that indicate a serious problem: ABRT, BUS, EMT, FPE, ILL, QUIT, SEGV, SYS, and TRAP.
Signals a program is most likely to encounter: HUP, INT, PIPE, and TERM.
Default. Signals trapped by default in older versions of
sigtrap: ABRT, BUS, EMT, FPE, ILL, PIPE, QUIT,
SEGV, SYS, TERM, and TRAP.
Installs handlers only for subsequently listed signals that aren't already taken care of.
Requires that the version of
sigtrap being used must be at least
Installs a handler for any argument that looks like a signal name.
Installs handlers only for subsequently listed signals not already trapped or ignored.