# One potential way of preventing the signals
# from taking down the process.
Linux::Perl::sigprocmask->block( 'INT', 'ABRT' );
my $sigfd = Linux::Perl::signalfd->new(
flags => ['NONBLOCK', 'CLOEXEC'],
signals => ['INT', 'ABRT'],
$sigfd->set_signals( 'INT' );
my @evts = $sigfd->read();
An implementation of Linux’s “signalfd”.
Note that you’ll need to ensure that whatever signals you expect to receive don’t take down the process. sigprocmask can help with this.
Creates a signalfd instance. %OPTS are:
signals - An array reference, each of whose members is either a string (e.g., INT) or a signal number.
flags - Optional, an array reference of either/both of: NONBLOCK, CLOEXEC.
Returns the file descriptor, which can be used with, e.g., select(), epoll(), or poll().
Reads events from the signalfd instance. Each event is a hash reference whose keys and values correspond to struct inotify_event. (cf. man 7 inotify)
man 7 inotify
In scalar context the return is the number of hash references that would be returned in list context.
An empty return (0 in scalar context) is an error state, in which case $! will indicate what the error was.
Updates the signalfd instance’s list of signals to listen for. @SIGNALS is a list such as the constructor’s signals argument.
This returns the instance.
1 POD Error
The following errors were encountered while parsing the POD:
Non-ASCII character seen before =encoding in 'Linux’s'. Assuming UTF-8
To install Linux::Perl, copy and paste the appropriate command in to your terminal.
perl -MCPAN -e shell
For more information on module installation, please visit the detailed CPAN module installation guide.