IO::Async::Signal(3pm)

IO::Async::Signal3pm

Event callback on receipt of a posix signal

Usage

   use IO::Async::Signal;
   use IO::Async::Loop;
   my $loop = IO::Async::Loop->new;
   my $signal = IO::Async::Signal->new(
      name => "HUP",
      on_receipt => sub {
          print "I caught SIGHUP\n";
      },
   );
   $loop->add( $signal );
   $loop->run;

Overview

This subclass of IO::Async::Notifier invokes its callback when a particular POSIX signal is received.

Multiple objects can be added to a "Loop" that all watch for the same signal. The callback functions will all be invoked, in no particular order.

Events

The following events are invoked, either using subclass methods or CODE references in parameters:

on_receipt

Invoked when the signal is received.

Parameters

The following named parameters may be passed to "new" or "configure":

name => STRING

The name of the signal to watch. This should be a bare name like "TERM". Can only be given at construction time.

on_receipt => CODE

CODE reference for the "on_receipt" event.

Once constructed, the "Signal" will need to be added to the "Loop" before it will work.

Releases

8 releases since Debian 6.0 (Squeeze); the text changed 7 times.

  1. 6.0
  2. 7
  3. 8
  4. 9
  5. 10
  6. 11
  7. 12
  8. 13

Author

Paul Evans <[email protected]>

From libio-async-perl 0.804-2 in Debian 13 (Trixie). Parsed by carta from the page's man source.