| 1 | # You may distribute under the terms of either the GNU General Public License | ||||||||||||||||||||||||||||
| 2 | # or the Artistic License (the same terms as Perl itself) | ||||||||||||||||||||||||||||
| 3 | # | ||||||||||||||||||||||||||||
| 4 | # (C) Paul Evans, 2010-2012 -- leonerd@leonerd.org.uk | ||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||
| 6 | package IO::Async::Loop::POE; | ||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||
| 8 | 11 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 9 | 11 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||
| 11 | 11 | our $VERSION = '0.05'; | |||||||||||||||||||||||||||
| 12 | 11 | ▶ | use constant API_VERSION => '0.49'; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||
| 14 | 11 | ▶ | use base qw( IO::Async::Loop ); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 15 | 11 | IO::Async::Loop->VERSION( '0.49' ); | |||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||
| 17 | 11 | ▶ | use Carp; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||
| 19 | 11 | ▶ | use POE::Kernel 1.293; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 20 | 11 | ▶ | use POE::Session; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||
| 22 | # Placate POE warning that we didn't call this | ||||||||||||||||||||||||||||
| 23 | # It won't do anything yet as we have no sessions | ||||||||||||||||||||||||||||
| 24 | 11 | POE::Kernel->run(); | |||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||
| 26 | =head1 NAME | ||||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||
| 28 | C<IO::Async::Loop::POE> - use C<IO::Async> with C<POE> | ||||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||
| 30 | =head1 SYNOPSIS | ||||||||||||||||||||||||||||
| 31 | |||||||||||||||||||||||||||||
| 32 | use IO::Async::Loop::POE; | ||||||||||||||||||||||||||||
| 33 | |||||||||||||||||||||||||||||
| 34 | my $loop = IO::Async::Loop::POE->new(); | ||||||||||||||||||||||||||||
| 35 | |||||||||||||||||||||||||||||
| 36 | $loop->add( ... ); | ||||||||||||||||||||||||||||
| 37 | |||||||||||||||||||||||||||||
| 38 | $loop->add( IO::Async::Signal->new( | ||||||||||||||||||||||||||||
| 39 | name => 'HUP', | ||||||||||||||||||||||||||||
| 40 | on_receipt => sub { ... }, | ||||||||||||||||||||||||||||
| 41 | ) ); | ||||||||||||||||||||||||||||
| 42 | |||||||||||||||||||||||||||||
| 43 | $loop->loop_forever(); | ||||||||||||||||||||||||||||
| 44 | |||||||||||||||||||||||||||||
| 45 | =head1 DESCRIPTION | ||||||||||||||||||||||||||||
| 46 | |||||||||||||||||||||||||||||
| 47 | This subclass of L<IO::Async::Loop> uses L<POE> to perform its work. | ||||||||||||||||||||||||||||
| 48 | |||||||||||||||||||||||||||||
| 49 | The entire C<IO::Async> system is represented by a single long-lived session | ||||||||||||||||||||||||||||
| 50 | within the C<POE> core. It fully supports sharing the process space with | ||||||||||||||||||||||||||||
| 51 | C<POE>; such resources as signals are properly shared between both event | ||||||||||||||||||||||||||||
| 52 | systems. | ||||||||||||||||||||||||||||
| 53 | |||||||||||||||||||||||||||||
| 54 | =head1 CONSTRUCTOR | ||||||||||||||||||||||||||||
| 55 | |||||||||||||||||||||||||||||
| 56 | =cut | ||||||||||||||||||||||||||||
| 57 | |||||||||||||||||||||||||||||
| 58 | =head2 $loop = IO::Async::Loop::POE->new( %args ) | ||||||||||||||||||||||||||||
| 59 | |||||||||||||||||||||||||||||
| 60 | This function returns a new instance of a C<IO::Async::Loop::POE> object. | ||||||||||||||||||||||||||||
| 61 | It takes the following named arguments: | ||||||||||||||||||||||||||||
| 62 | |||||||||||||||||||||||||||||
| 63 | =over 8 | ||||||||||||||||||||||||||||
| 64 | |||||||||||||||||||||||||||||
| 65 | =back | ||||||||||||||||||||||||||||
| 66 | |||||||||||||||||||||||||||||
| 67 | =cut | ||||||||||||||||||||||||||||
| 68 | |||||||||||||||||||||||||||||
| 69 | sub new | ||||||||||||||||||||||||||||
| 70 | { | ||||||||||||||||||||||||||||
| 71 | 10 | ▶ | my $class = shift; | ||||||||||||||||||||||||||
|
Subroutine
new: called CC=1 SCAR=0.1
Pod
documented
| |||||||||||||||||||||||||||||
| 72 | 10 | my ( %args ) = @_; | |||||||||||||||||||||||||||
| 73 | |||||||||||||||||||||||||||||
| 74 | 10 | my $self = $class->SUPER::__new( %args ); | |||||||||||||||||||||||||||
| 75 | |||||||||||||||||||||||||||||
| 76 | 10 | my $kernelref = \($self->{kernel} = undef); | |||||||||||||||||||||||||||
| 77 | |||||||||||||||||||||||||||||
| 78 | $self->{session} = POE::Session->create( | ||||||||||||||||||||||||||||
| 79 | inline_states => { | ||||||||||||||||||||||||||||
| 80 | _start => sub { | ||||||||||||||||||||||||||||
| 81 | 10 | ▶ | $_[KERNEL]->alias_set( "IO::Async" ); | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 82 | 10 | $$kernelref = $_[KERNEL]; | |||||||||||||||||||||||||||
| 83 | }, | ||||||||||||||||||||||||||||
| 84 | |||||||||||||||||||||||||||||
| 85 | invoke => sub { | ||||||||||||||||||||||||||||
| 86 | # CODEref is always in the last position, but what that is varies | ||||||||||||||||||||||||||||
| 87 | # given the different events use different initial args | ||||||||||||||||||||||||||||
| 88 | 2 | ▶ | $_[-1]->(); | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 89 | }, | ||||||||||||||||||||||||||||
| 90 | |||||||||||||||||||||||||||||
| 91 | select_read => sub { | ||||||||||||||||||||||||||||
| 92 | 1 | ▶ | $_[KERNEL]->select_read( $_[ARG0], invoke => $_[ARG1] ); | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 93 | }, | ||||||||||||||||||||||||||||
| 94 | unselect_read => sub { | ||||||||||||||||||||||||||||
| 95 | 0 | ▶ | $_[KERNEL]->select_read( $_[ARG0] ); | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 96 | }, | ||||||||||||||||||||||||||||
| 97 | select_write => sub { | ||||||||||||||||||||||||||||
| 98 | 0 | ▶ | $_[KERNEL]->select_write( $_[ARG0], invoke => $_[ARG1] ); | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 99 | }, | ||||||||||||||||||||||||||||
| 100 | unselect_write => sub { | ||||||||||||||||||||||||||||
| 101 | 0 | ▶ | $_[KERNEL]->select_write( $_[ARG0] ); | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 102 | }, | ||||||||||||||||||||||||||||
| 103 | |||||||||||||||||||||||||||||
| 104 | alarm_set => sub { | ||||||||||||||||||||||||||||
| 105 | 0 | ▶ | $_[KERNEL]->alarm_set( invoke => $_[ARG0], $_[ARG1] ); | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 106 | }, | ||||||||||||||||||||||||||||
| 107 | delay_set => sub { | ||||||||||||||||||||||||||||
| 108 | 1 | ▶ | $_[KERNEL]->delay_set( invoke => $_[ARG0], $_[ARG1] ); | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 109 | }, | ||||||||||||||||||||||||||||
| 110 | alarm_remove => sub { | ||||||||||||||||||||||||||||
| 111 | 12 | ▶ | $_[KERNEL]->alarm_remove( $_[ARG0] ); | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 112 | }, | ||||||||||||||||||||||||||||
| 113 | |||||||||||||||||||||||||||||
| 114 | sig => sub { | ||||||||||||||||||||||||||||
| 115 | 1 | ▶ | $_[KERNEL]->sig( $_[ARG0], ( $_[ARG0] eq "CHLD" ) ? "invoke_child" : "invoke_signal", $_[ARG1] ); | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=7.6
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 116 | }, | ||||||||||||||||||||||||||||
| 117 | unsig => sub { | ||||||||||||||||||||||||||||
| 118 | 0 | ▶ | $_[KERNEL]->sig( $_[ARG0] ); | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 119 | }, | ||||||||||||||||||||||||||||
| 120 | invoke_signal => sub { | ||||||||||||||||||||||||||||
| 121 | 1 | ▶ | $_[-1]->(); | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 122 | 1 | $_[KERNEL]->sig_handled; | |||||||||||||||||||||||||||
| 123 | }, | ||||||||||||||||||||||||||||
| 124 | |||||||||||||||||||||||||||||
| 125 | sig_child => sub { | ||||||||||||||||||||||||||||
| 126 | 1 | ▶ | $_[KERNEL]->sig_child( $_[ARG0], invoke_child => $_[ARG1] ); | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 127 | }, | ||||||||||||||||||||||||||||
| 128 | unsig_child => sub { | ||||||||||||||||||||||||||||
| 129 | 1 | ▶ | $_[KERNEL]->sig_child( $_[ARG0] ); | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 130 | }, | ||||||||||||||||||||||||||||
| 131 | invoke_child => sub { | ||||||||||||||||||||||||||||
| 132 | 1 | ▶ | $_[-1]->( $_[ARG1], $_[ARG2] ); # $pid, $dollarq | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 133 | }, | ||||||||||||||||||||||||||||
| 134 | } | ||||||||||||||||||||||||||||
| 135 | 10 | ); | |||||||||||||||||||||||||||
| 136 | |||||||||||||||||||||||||||||
| 137 | 10 | return $self; | |||||||||||||||||||||||||||
| 138 | } | ||||||||||||||||||||||||||||
| 139 | |||||||||||||||||||||||||||||
| 140 | sub _call | ||||||||||||||||||||||||||||
| 141 | { | ||||||||||||||||||||||||||||
| 142 | 17 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
_call: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 143 | 17 | $self->{kernel}->call( $self->{session}, @_ ); | |||||||||||||||||||||||||||
| 144 | } | ||||||||||||||||||||||||||||
| 145 | |||||||||||||||||||||||||||||
| 146 | sub loop_once | ||||||||||||||||||||||||||||
| 147 | { | ||||||||||||||||||||||||||||
| 148 | 12 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
loop_once: called CC=4 SCAR=16.3
Pod
documented
| |||||||||||||||||||||||||||||
| 149 | 12 | my ( $timeout ) = @_; | |||||||||||||||||||||||||||
| 150 | |||||||||||||||||||||||||||||
| 151 | 12 | ▶ | if( defined $timeout and $timeout == 0 ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
defined $timeout and $timeout == 0
MC/DC0%0/2
defined $timeout and $timeout == 0
defined $timeout
$timeout == 0
Truth table33%1/3
A and B
A= defined $timeoutB= $timeout == 0
| |||||||||||||||||||||||||||||
| 152 | 0 | $self->{kernel}->run_one_timeslice; | |||||||||||||||||||||||||||
| 153 | 0 | return; | |||||||||||||||||||||||||||
| 154 | } | ||||||||||||||||||||||||||||
| 155 | |||||||||||||||||||||||||||||
| 156 | 12 | my $timer_id; | |||||||||||||||||||||||||||
| 157 | 12 | ▶ | if( defined $timeout ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 158 | 0 | ▶ | $timer_id = $self->_call( delay_set => $timeout, sub { } ); | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 159 | } | ||||||||||||||||||||||||||||
| 160 | |||||||||||||||||||||||||||||
| 161 | 12 | $self->{kernel}->run_one_timeslice; | |||||||||||||||||||||||||||
| 162 | |||||||||||||||||||||||||||||
| 163 | 12 | $self->_call( alarm_remove => $timer_id ); | |||||||||||||||||||||||||||
| 164 | } | ||||||||||||||||||||||||||||
| 165 | |||||||||||||||||||||||||||||
| 166 | sub watch_io | ||||||||||||||||||||||||||||
| 167 | { | ||||||||||||||||||||||||||||
| 168 | 1 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
watch_io: called CC=4 SCAR=15.0
Pod
documented
| |||||||||||||||||||||||||||||
| 169 | 1 | my %params = @_; | |||||||||||||||||||||||||||
| 170 | |||||||||||||||||||||||||||||
| 171 | 1 | ▶ | my $handle = $params{handle} or die "Need a handle"; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 172 | |||||||||||||||||||||||||||||
| 173 | 1 | ▶ | if( my $on_read_ready = $params{on_read_ready} ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 174 | 1 | $self->_call( select_read => $handle, $on_read_ready ); | |||||||||||||||||||||||||||
| 175 | } | ||||||||||||||||||||||||||||
| 176 | |||||||||||||||||||||||||||||
| 177 | 1 | ▶ | if( my $on_write_ready = $params{on_write_ready} ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 178 | 0 | $self->_call( select_write => $handle, $on_write_ready ); | |||||||||||||||||||||||||||
| 179 | } | ||||||||||||||||||||||||||||
| 180 | } | ||||||||||||||||||||||||||||
| 181 | |||||||||||||||||||||||||||||
| 182 | sub unwatch_io | ||||||||||||||||||||||||||||
| 183 | { | ||||||||||||||||||||||||||||
| 184 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
unwatch_io: not called CC=4 SCAR=30.0
Pod
documented
| |||||||||||||||||||||||||||||
| 185 | 0 | my %params = @_; | |||||||||||||||||||||||||||
| 186 | |||||||||||||||||||||||||||||
| 187 | 0 | ▶ | my $handle = $params{handle} or die "Need a handle"; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 188 | |||||||||||||||||||||||||||||
| 189 | 0 | ▶ | if( my $on_read_ready = $params{on_read_ready} ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 190 | 0 | $self->_call( unselect_read => $handle ); | |||||||||||||||||||||||||||
| 191 | } | ||||||||||||||||||||||||||||
| 192 | |||||||||||||||||||||||||||||
| 193 | 0 | ▶ | if( my $on_write_ready = $params{on_write_ready} ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 194 | 0 | $self->_call( unselect_write => $handle ); | |||||||||||||||||||||||||||
| 195 | } | ||||||||||||||||||||||||||||
| 196 | } | ||||||||||||||||||||||||||||
| 197 | |||||||||||||||||||||||||||||
| 198 | sub watch_time | ||||||||||||||||||||||||||||
| 199 | { | ||||||||||||||||||||||||||||
| 200 | 1 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
watch_time: called CC=4 SCAR=15.9
Pod
documented
| |||||||||||||||||||||||||||||
| 201 | 1 | my %params = @_; | |||||||||||||||||||||||||||
| 202 | |||||||||||||||||||||||||||||
| 203 | 1 | ▶ | my $code = $params{code} or croak "Expected 'code' as CODE ref"; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 204 | |||||||||||||||||||||||||||||
| 205 | 1 | ▶ | if( defined $params{at} ) { | ||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||
| 206 | 0 | return $self->_call( alarm_set => $params{at}, $code ); | |||||||||||||||||||||||||||
| 207 | } | ||||||||||||||||||||||||||||
| 208 | elsif( defined $params{after} ) { | ||||||||||||||||||||||||||||
| 209 | 1 | return $self->_call( delay_set => $params{after}, $code ); | |||||||||||||||||||||||||||
| 210 | } | ||||||||||||||||||||||||||||
| 211 | else { | ||||||||||||||||||||||||||||
| 212 | 0 | croak "Expected either 'at' or 'after'"; | |||||||||||||||||||||||||||
| 213 | } | ||||||||||||||||||||||||||||
| 214 | } | ||||||||||||||||||||||||||||
| 215 | |||||||||||||||||||||||||||||
| 216 | sub unwatch_time | ||||||||||||||||||||||||||||
| 217 | { | ||||||||||||||||||||||||||||
| 218 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
unwatch_time: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 219 | 0 | my ( $id ) = @_; | |||||||||||||||||||||||||||
| 220 | |||||||||||||||||||||||||||||
| 221 | 0 | $self->_call( alarm_remove => $id ); | |||||||||||||||||||||||||||
| 222 | } | ||||||||||||||||||||||||||||
| 223 | |||||||||||||||||||||||||||||
| 224 | sub watch_signal | ||||||||||||||||||||||||||||
| 225 | { | ||||||||||||||||||||||||||||
| 226 | 1 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
watch_signal: called CC=2 SCAR=7.0
Pod
documented
| |||||||||||||||||||||||||||||
| 227 | 1 | my ( $signal, $code ) = @_; | |||||||||||||||||||||||||||
| 228 | |||||||||||||||||||||||||||||
| 229 | 1 | ▶ | exists $SIG{$signal} or croak "Cannot watch signal '$signal' - bad signal name"; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 230 | |||||||||||||||||||||||||||||
| 231 | 1 | $self->_call( sig => $signal, $code ); | |||||||||||||||||||||||||||
| 232 | } | ||||||||||||||||||||||||||||
| 233 | |||||||||||||||||||||||||||||
| 234 | sub unwatch_signal | ||||||||||||||||||||||||||||
| 235 | { | ||||||||||||||||||||||||||||
| 236 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
unwatch_signal: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 237 | 0 | my ( $signal ) = @_; | |||||||||||||||||||||||||||
| 238 | |||||||||||||||||||||||||||||
| 239 | 0 | $self->_call( unsig => $signal ); | |||||||||||||||||||||||||||
| 240 | } | ||||||||||||||||||||||||||||
| 241 | |||||||||||||||||||||||||||||
| 242 | sub watch_idle | ||||||||||||||||||||||||||||
| 243 | { | ||||||||||||||||||||||||||||
| 244 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
watch_idle: not called CC=4 SCAR=30.0
Pod
documented
| |||||||||||||||||||||||||||||
| 245 | 0 | my %params = @_; | |||||||||||||||||||||||||||
| 246 | |||||||||||||||||||||||||||||
| 247 | 0 | ▶ | my $when = delete $params{when} or croak "Expected 'when'"; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 248 | |||||||||||||||||||||||||||||
| 249 | 0 | ▶ | my $code = delete $params{code} or croak "Expected 'code' as a CODE ref"; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 250 | |||||||||||||||||||||||||||||
| 251 | 0 | ▶ | $when eq "later" or croak "Expected 'when' to be 'later'"; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 252 | |||||||||||||||||||||||||||||
| 253 | 0 | return $self->_call( delay_set => 0, $code ); | |||||||||||||||||||||||||||
| 254 | } | ||||||||||||||||||||||||||||
| 255 | |||||||||||||||||||||||||||||
| 256 | sub unwatch_idle | ||||||||||||||||||||||||||||
| 257 | { | ||||||||||||||||||||||||||||
| 258 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
unwatch_idle: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 259 | 0 | my ( $id ) = @_; | |||||||||||||||||||||||||||
| 260 | |||||||||||||||||||||||||||||
| 261 | 0 | $self->_call( alarm_remove => $id ); | |||||||||||||||||||||||||||
| 262 | } | ||||||||||||||||||||||||||||
| 263 | |||||||||||||||||||||||||||||
| 264 | sub watch_child | ||||||||||||||||||||||||||||
| 265 | { | ||||||||||||||||||||||||||||
| 266 | 1 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
watch_child: called CC=2 SCAR=7.4
Pod
undocumented
| |||||||||||||||||||||||||||||
| 267 | 1 | my ( $pid, $code ) = @_; | |||||||||||||||||||||||||||
| 268 | |||||||||||||||||||||||||||||
| 269 | 1 | ▶ | if( $pid ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 270 | 1 | $self->_call( sig_child => $pid, $code ); | |||||||||||||||||||||||||||
| 271 | } | ||||||||||||||||||||||||||||
| 272 | else { | ||||||||||||||||||||||||||||
| 273 | 0 | $self->_call( sig => "CHLD", $code ); | |||||||||||||||||||||||||||
| 274 | } | ||||||||||||||||||||||||||||
| 275 | } | ||||||||||||||||||||||||||||
| 276 | |||||||||||||||||||||||||||||
| 277 | sub unwatch_child | ||||||||||||||||||||||||||||
| 278 | { | ||||||||||||||||||||||||||||
| 279 | 1 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
unwatch_child: called CC=2 SCAR=7.4
Pod
undocumented
| |||||||||||||||||||||||||||||
| 280 | 1 | my ( $pid ) = @_; | |||||||||||||||||||||||||||
| 281 | |||||||||||||||||||||||||||||
| 282 | 1 | ▶ | if( $pid ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 283 | 1 | $self->_call( unsig_child => $pid ); | |||||||||||||||||||||||||||
| 284 | } | ||||||||||||||||||||||||||||
| 285 | else { | ||||||||||||||||||||||||||||
| 286 | 0 | $self->_call( unsig => "CHLD" ); | |||||||||||||||||||||||||||
| 287 | } | ||||||||||||||||||||||||||||
| 288 | } | ||||||||||||||||||||||||||||
| 289 | |||||||||||||||||||||||||||||
| 290 | =head1 AUTHOR | ||||||||||||||||||||||||||||
| 291 | |||||||||||||||||||||||||||||
| 292 | Paul Evans <leonerd@leonerd.org.uk> | ||||||||||||||||||||||||||||
| 293 | |||||||||||||||||||||||||||||
| 294 | =cut | ||||||||||||||||||||||||||||
| 295 | |||||||||||||||||||||||||||||
| 296 | 11 | 0x55AA; | |||||||||||||||||||||||||||