start page | rating of books | rating of authors | reviews | copyrights
8.186. sigtrap
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);
8.186.1. Signal Handler Options
Used to specify which handler will be installed for signals installed
after the handler:
- die
-
Installs handler that die s with a message
indicating the signal that was trapped.
- handler handlername
-
Installs your handler handlername.
- stack-trace
-
Default signal handler. Outputs stack trace to STDERR and tries to
dump core.
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:
- error-signals
-
Signals that indicate a serious problem: ABRT, BUS, EMT, FPE, ILL,
QUIT, SEGV, SYS, and TRAP.
- normal-signals
-
Signals a program is most likely to encounter: HUP, INT, PIPE, and
TERM.
- old-interface-signals
-
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
- any
-
Installs handlers only for subsequently listed signals that
aren't already taken care of.
- number
-
Requires that the version of sigtrap being used
must be at least number.
- signal
-
Installs a handler for any argument that looks like a signal name.
- untrapped
-
Installs handlers only for subsequently listed signals not already
trapped or ignored.
| | |
8.185. Shell | | 8.187. Socket |
Copyright © 2002 O'Reilly & Associates. All rights reserved.