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 $sig croaks with Negative signals are not allowed.

  • An action hash without a HANDLER key croaks with Can't supply an action without a HANDLER.

See also#

  • sigprocmask - change the blocked-signal mask.

  • POSIX::SigSet - build the MASK field of an action.