1IO::Async::Signal(3)  User Contributed Perl Documentation IO::Async::Signal(3)
2
3
4

NAME

6       "IO::Async::Signal" - event callback on receipt of a POSIX signal
7

SYNOPSIS

9        use IO::Async::Signal;
10
11        use IO::Async::Loop;
12        my $loop = IO::Async::Loop->new;
13
14        my $signal = IO::Async::Signal->new(
15           name => "HUP",
16
17           on_receipt => sub {
18               print "I caught SIGHUP\n";
19           },
20        );
21
22        $loop->add( $signal );
23
24        $loop->run;
25

DESCRIPTION

27       This subclass of IO::Async::Notifier invokes its callback when a
28       particular POSIX signal is received.
29
30       Multiple objects can be added to a "Loop" that all watch for the same
31       signal.  The callback functions will all be invoked, in no particular
32       order.
33

EVENTS

35       The following events are invoked, either using subclass methods or CODE
36       references in parameters:
37
38   on_receipt
39       Invoked when the signal is received.
40

PARAMETERS

42       The following named parameters may be passed to "new" or "configure":
43
44   name => STRING
45       The name of the signal to watch. This should be a bare name like
46       "TERM". Can only be given at construction time.
47
48   on_receipt => CODE
49       CODE reference for the "on_receipt" event.
50
51       Once constructed, the "Signal" will need to be added to the "Loop"
52       before it will work.
53

AUTHOR

55       Paul Evans <leonerd@leonerd.org.uk>
56
57
58
59perl v5.30.0                      2019-07-26              IO::Async::Signal(3)
Impressum