IO::Async::SignalProxy - a class to allow handling of POSIX signals with IO::Async-based IO
IO::Async::SignalProxy
IO::Async
Usually this object would be used indirectly, via an IO::Async::Set:
IO::Async::Set
use IO::Async::Set::...; my $set = IO::Async::Set::... $set->attach_signal( HUP => sub { reread_config() } );
It can also be used directly:
use IO::Async::SignalProxy; my $sigproxy = IO::Async::SignalProxy->new( signal_HUP => sub { reread_config() }, ); $sigproxy->attach( TERM => sub { print STDERR "I should exit now\n" } ); my $set = IO::Async::Set::... $set->add( $sigproxy );
This module provides a class that allows POSIX signals to be handled safely alongside other IO operations on filehandles in an IO::Async::Set. Because signals could arrive at any time, care must be taken that they do not interrupt the normal flow of the program, and are handled at the same time as other events in the IO::Async::Set's results.
This function returns a new instance of a IO::Async::SignalProxy object. The %params hash takes keys that specify callback functions to run when signals arrive. They are all of the form
%params
signal_$NAME => sub { ... }
where $NAME is the basic POSIX name for the signal, such as TERM or CHLD.
$NAME
TERM
CHLD
This method adds a new signal handler to the proxy object, and associates the given code reference with it.
The name of the signal to attach to. This should be a bare name like TERM.
A CODE reference to the handling function.
This method removes a signal handler from the proxy object. Any signal that has previously been attach()ed or was passed into the constructor may be detached.
attach()
POSIX for the SIGname constants
SIGname
Paul Evans <leonerd@leonerd.org.uk>
To install IO::Async::Set, copy and paste the appropriate command in to your terminal.
cpanm
cpanm IO::Async::Set
CPAN shell
perl -MCPAN -e shell install IO::Async::Set
For more information on module installation, please visit the detailed CPAN module installation guide.