sigaction#
Install or inspect a signal handler for signal $sig.
Synopsis#
use POSIX qw(sigaction SIGINT);
my $action = POSIX::SigAction->new("IGNORE");
my $old = POSIX::SigAction->new;
sigaction(SIGINT, $action, $old);
What you get back#
"0 but true" on success, undef on failure. When $oldaction
is supplied, it is populated with the previous HANDLER, MASK,
FLAGS, and SAFE fields.
Edge cases#
Negative
$sigcroaks withNegative signals are not allowed.An action hash without a
HANDLERkey croaks withCan't supply an action without a HANDLER.
Note
pp runtime
Only string handlers ("DEFAULT", "IGNORE", "") are
installed directly. Coderef handlers return undef without
installing the action. The perl5 callback bridge is the missing
piece for full coderef support.
Differences from upstream#
Coderef handlers are not yet wired to the perl5 callback bridge, so passing one silently falls through and leaves the current disposition in place. Upstream would invoke the Perl code on signal delivery.
See also#
sigprocmask— change the blocked-signal mask.POSIX::SigSet— build theMASKfield of an action.