sigaction#

Install or inspect a signal handler for signal $sig.

תקציר#

use POSIX qw(sigaction SIGINT);
my $action = POSIX::SigAction->new("IGNORE");
my $old = POSIX::SigAction->new;
sigaction(SIGINT, $action, $old);

מה מוחזר#

"0 but true" on success, undef on failure. When $oldaction is supplied, it is populated with the previous HANDLER, MASK, FLAGS, and SAFE fields.

מקרי קצה#

  • 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.

הבדלים מן ה-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.

ראו גם#

  • sigprocmask - change the blocked-signal mask.

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