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
8.186.1. Signal Handler Options
Used to specify which handler will be installed for signals installed
after the handler:
Installs handler that die s with a message
indicating the signal that was trapped.
- handler handlername
Installs your handler handlername.
Default signal handler. Outputs stack trace to STDERR and tries to
8.186.2. Signal List Options
You can specify your own list of options:
use sigtrap qw(BUS SEGV PIPE ABRT);
or use one of the following built-in option lists:
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
Default. Signals trapped by default in older versions of
sigtrap: ABRT, BUS, EMT, FPE, ILL, PIPE, QUIT,
SEGV, SYS, TERM, and TRAP.
8.186.3. Other Options
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 number.
Installs a handler for any argument that looks like a signal name.
Installs handlers only for subsequently listed signals not already
trapped or ignored.
Copyright © 2002 O'Reilly & Associates. All rights reserved.