IO::Async::Signal - event callback on receipt of a POSIX signal
IO::Async::Signal
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->loop_forever;
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.
Loop
The following events are invoked, either using subclass methods or CODE references in parameters:
Invoked when the signal is received.
The following named parameters may be passed to new or configure:
new
configure
The name of the signal to watch. This should be a bare name like TERM. Can only be given at construction time.
TERM
CODE reference for the on_receipt event.
on_receipt
Once constructed, the Signal will need to be added to the Loop before it will work.
Signal
Paul Evans <leonerd@leonerd.org.uk>
To install IO::Async, copy and paste the appropriate command in to your terminal.
cpanm
cpanm IO::Async
CPAN shell
perl -MCPAN -e shell install IO::Async
For more information on module installation, please visit the detailed CPAN module installation guide.