Mojo::IOLoop::Signal - Non-blocking signal handler
use Mojo::IOLoop::Signal; Mojo::IOLoop::Signal->on(TERM => sub { my ($self, $name) = @_; warn "Got $name signal"; }); Mojo::IOLoop->start unless Mojo::IOLoop->is_running;
Mojo::IOLoop::Signal is a Mojo::IOLoop based, non-blocking signal handler.
Mojo::IOLoop::Signal inherits all events from Mojo::EventEmitter and can emit the following new ones.
See $Config{sig_name} for a complete list.
$Config{sig_name}
$ perl -MConfig -e 'print $Config{sig_name}' ZERO HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM URG STOP TSTP CONT CHLD TTIN TTOU IO XCPU XFSZ VTALRM PROF WINCH INFO USR1 USR2 IOT
Mojo::IOLoop::Signal inherits all methods from Mojo::EventEmitter and implements the following new ones.
Mojo::IOLoop::Signal->stop;
Stop watching signals. You might want to use stop like:
stop
Mojo::IOLoop::Signal->on(HUP => sub { my ($self, $name) = @_; # log rotate }); Mojo::IOLoop::Signal->on(TERM => sub { my ($self, $name) = @_; $self->stop; }); Mojo::IOLoop->start;
Shoichi Kaji <skaji@cpan.org>
Copyright 2016 Shoichi Kaji <skaji@cpan.org>
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install Mojo::IOLoop::Signal, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Mojo::IOLoop::Signal
CPAN shell
perl -MCPAN -e shell install Mojo::IOLoop::Signal
For more information on module installation, please visit the detailed CPAN module installation guide.