Examples of sigtrap
Provide a stack trace for the old interface signals:
use sigtrap;
Same thing, but more explicitly:
use sigtrap qw(stack–trace old–interface–signals);
Provide a stack trace only on the four listed signals:
use sigtrap qw(BUS SEGV PIPE ABRT);
Die on an INT or a QUIT signal:
use sigtrap qw(die INT QUIT);
Die on any of HUP, INT, PIPE,
or TERM:
use sigtrap qw(die normal–signals);
Die on HUP, INT, PIPE,
or TERM—except don’t change the
behavior for signals that have already been trapped or ignored elsewhere
in the program:
use sigtrap qw(die untrapped normal–signals);
Die on receipt of any currently untrapped normal–signals; additionally, provide a stack
backtrace on receipt of any of the error–signals:
use sigtrap qw(die untrapped normal–signals
stack–trace any error–signals);Install the routine my_handler
as the handler for the normal–signals:
use sigtrap "handler" => \&my_handler, "normal–signals";
Install my_handler as the
handler for the normal–signals;
provide a Perl stack backtrace on receipt of any of the error–signals:
use sigtrap qw(handler my_handler normal–signals
stack–trace error–signals);Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access