IO/ImplBase.pm

filter: Statementstmt 87.1% 136 / 156 Branchbran 70.6% 41 / 58 Conditioncond 48.9% 23 / 47 MC/DCmcdc 25.8% 8 / 31 Subroutinesub 88.8% 32 / 36 Podpod 100% 12 / 12 totaltotal 74.1% 252 / 340 CC 46 SCAR 16.2
CC
46
Cov
77%
__ANON__
17.1
__ANON__
7.5
sleep
7.0
CRAP 5.1
« IO.pm ↑ Summary
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, 2019-2026 -- leonerd@leonerd.org.uk
5  
6 package Future::IO::ImplBase 0.23;
7  
8 18 ▶use v5.14;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 18 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 18 ▶use Future::IO qw( POLLIN POLLOUT POLLPRI );
Subroutine BEGIN: called CC=1 SCAR=0.0
12  
13 18 ▶use Errno qw( EAGAIN EWOULDBLOCK EINPROGRESS );
Subroutine BEGIN: called CC=1 SCAR=0.0
14 18 ▶use Socket qw( SOL_SOCKET SO_ERROR );
Subroutine BEGIN: called CC=1 SCAR=0.0
15 18 ▶use Struct::Dumb qw( readonly_struct );
Subroutine BEGIN: called CC=1 SCAR=0.0
16 18 ▶use Time::HiRes qw( time );
Subroutine BEGIN: called CC=1 SCAR=0.0
17  
18 # connect() yields EWOULDBLOCK on MSWin32
19 18 ▶use constant CONNECT_EWOULDBLOCK => ( $^O eq "MSWin32" );
Subroutine BEGIN: called CC=1 SCAR=0.0
20  
21 18 ▶use constant HAVE_MULTIPLE_FILEHANDLES => 1;
Subroutine BEGIN: called CC=1 SCAR=0.0
22  
23 =head1 NAME
24  
25 C<Future::IO::ImplBase> - base class for C<Future::IO> implementations
26  
27 =head1 DESCRIPTION
28  
29 This package provides a few utility methods that may help writing actual
30 L<Future::IO> implementation classes. It is entirely optional; implementations
31 are not required to use it.
32  
33 =cut
34  
35 =head1 CLASS METHODS
36  
37 =cut
38  
39 =head2 APPLY
40  
41 __PACKAGE__->APPLY;
42  
43 Attempts to set the value of the C<$Future::IO::IMPL> variable to the name of
44 the calling package.
45  
46 =cut
47  
48 sub APPLY
49 0 ▶{
Subroutine APPLY: not called CC=3 SCAR=18.1
Pod documented
50 0 my $pkg = shift;
51  
52 18 ▶ no warnings 'once';
Subroutine BEGIN: called CC=1 SCAR=0.0
53 0 ▶ ( $Future::IO::IMPL //= $pkg ) eq $pkg or
Branch: 1 branch
BranchTrueFalseTotal
($Future::IO::IMPL //= $pkg) eq $pkg or warn "Unable to set Future::IO implementation to $pkg" . " as it is already $Future::IO::IMPL\n" 0 0 0
Condition0%0/3
$Future::IO::IMPL //= $pkg
l!l&&r!l&&!r
000
MC/DC0%0/2
$Future::IO::IMPL //= $pkg
$Future::IO::IMPL $pkg
Truth table0%0/3
A //= B
A= $Future::IO::IMPLB= $pkg
ABresult
1X1
011
000
54 warn "Unable to set Future::IO implementation to $pkg".
55 " as it is already $Future::IO::IMPL\n";
56 }
57  
58 =head1 DEFAULT METHODS
59  
60 These methods are provided based on lower-level functionallity that the
61 implementing class should provide.
62  
63 =cut
64  
65 =head2 accept
66  
67 Implemented by wrapping C<poll(POLLIN)>, as L</sysread> uses.
68  
69 =cut
70  
71 sub accept
72 1 ▶{
Subroutine accept: called CC=1 SCAR=0.1
Pod documented
73 1 my $self = shift;
74 1 my ( $fh ) = @_;
75  
76 1 ▶ return $self->poll( $fh, POLLIN )->then( sub {
Subroutine __ANON__: called CC=2 SCAR=7.6
77 1 my $accepted = $fh->accept;
78 1 ▶ if( $accepted ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($accepted) { } 1 0 1
79 1 return Future->done( $accepted );
80 }
81 else {
82 0 return Future->fail( "accept: $!\n", accept => $fh, $! );
83 }
84 1 } );
85 }
86  
87 =head2 alarm
88  
89 Implemented by wrapping C<sleep>.
90  
91 =cut
92  
93 sub alarm
94 0 ▶{
Subroutine alarm: not called CC=1 SCAR=6.9
Pod documented
95 0 my $self = shift;
96 0 my ( $time ) = @_;
97  
98 0 return $self->sleep( $time - time() );
99 }
100  
101 =head2 connect
102  
103 Implemented by wrapping C<poll(POLLOUT)>, as L</syswrite> uses.
104  
105 =cut
106  
107 sub connect
108 2 ▶{
Subroutine connect: called CC=4 SCAR=14.1
Pod documented
109 2 my $self = shift;
110 2 my ( $fh, $name ) = @_;
111  
112 # We can't use IO::Socket->connect here because
113 # https://github.com/Perl/perl5/issues/19326
114  
115 2 my $ret = CORE::connect( $fh, $name );
116 2 my $errno = $!;
117  
118 2 ▶ return Future->done if $ret;
Branch: 1 branch
BranchTrueFalseTotal
if $ret 0 2 2
119  
120 2 ▶ unless( $errno == EINPROGRESS or
Branch: 1 branch
BranchTrueFalseTotal
unless ($errno == 115 or !!0) 0 2 2
Condition50%1/2
$errno == 115 or !!0
l!l
20
MC/DC0%0/1
$errno == 115 or !!0
$errno == 115
Truth table50%1/2
A
A= $errno == 115
Aresult
11
00
121 ( CONNECT_EWOULDBLOCK and $errno == EWOULDBLOCK ) ) {
122 0 return Future->fail( "connect: $errno\n", connect => $fh, $errno );
123 }
124  
125 # not synchronous result
126  
127 2 ▶ return $self->poll( $fh, POLLOUT|POLLPRI )->then( sub {
Subroutine __ANON__: called CC=2 SCAR=6.9
128 2 $errno = $fh->getsockopt( SOL_SOCKET, SO_ERROR );
129  
130 2 ▶ if( $errno ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($errno) 1 1 2
131 1 $! = $errno;
132 1 return Future->fail( "connect: $!\n", connect => $fh, $! );
133 }
134  
135 1 return Future->done;
136 2 } );
137 }
138  
139 =head2 recv
140  
141 =head2 recvfrom
142  
143 Implemented by wrapping C<poll(POLLIN)>, as L</sysread> uses.
144  
145 =cut
146  
147 sub _recv1
148 8 ▶{
Subroutine _recv1: called CC=2 SCAR=8.5
149 8 my $self = shift;
150 8 my ( $f, $with_fromaddr, $fh, $length, $flags ) = @_;
151  
152 6 ▶ my $waitf = $self->poll( $fh, POLLIN )->on_done( sub {
Subroutine __ANON__: called CC=8 SCAR=28.4
153 6 my $fromaddr = $fh->recv( my $buf, $length, $flags );
154 6 ▶ if( defined $fromaddr and length $buf ) {
Branch: 3 branches
BranchTrueFalseTotal
if (defined $fromaddr and length $buf) { } 4 2 6
elsif (defined $fromaddr) { } 2 0 2
elsif ($! == 11 or $! == 11) { } 0 0 0
Condition66%2/3
defined $fromaddr and length $buf
!ll&&!rl&&r
024
MC/DC50%1/2
defined $fromaddr and length $buf
defined $fromaddr length $buf
Truth table66%2/3
A and B
A= defined $fromaddrB= length $buf
ABresult
0X0
100
111
155 4 ▶ $f->done( $buf, $with_fromaddr ? ( $fromaddr ) : () );
Branch: 1 branch
BranchTrueFalseTotal
$with_fromaddr ? : 2 2 4
156 }
157 elsif( defined $fromaddr ) {
158 2 $f->done(); # fromaddr is not interesting at EOF
159 }
160 ▶ elsif( $! == EAGAIN or $! == EWOULDBLOCK ) {
Condition0%0/3
$! == 11 or $! == 11
l!l&&r!l&&!r
000
MC/DC0%0/2
$! == 11 or $! == 11
$! == 11 $! == 11
Truth table0%0/3
A or B
A= $! == 11B= $! == 11
ABresult
1X1
011
000
161 # Try again
162 0 $self->_recv1( $f, $with_fromaddr, $fh, $length, $flags );
163 }
164 else {
165 0 ▶ my $name = $with_fromaddr ? "recvfrom" : "recv";
Branch: 1 branch
BranchTrueFalseTotal
$with_fromaddr ? : 0 0 0
166 0 $f->fail( "$name: $!\n", $name => $fh, $! );
167 }
168 8 });
169  
170 8 ▶ $f //= $waitf->new;
Condition33%1/3
$f //= $waitf->new
l!l&&r!l&&!r
080
MC/DC0%0/2
$f //= $waitf->new
$f $waitf->new
Truth table33%1/3
A //= B
A= $fB= $waitf->new
ABresult
1X1
011
000
171  
172 8 $f->on_cancel( $waitf );
173  
174 8 return $f;
175 }
176  
177 sub recv
178 4 ▶{
Subroutine recv: called CC=1 SCAR=0.0
Pod documented
179 4 my $self = shift;
180 4 return $self->_recv1( undef, 0, @_ );
181 }
182  
183 sub recvfrom
184 4 ▶{
Subroutine recvfrom: called CC=1 SCAR=0.0
Pod documented
185 4 my $self = shift;
186 4 return $self->_recv1( undef, 1, @_ );
187 }
188  
189 =head2 send
190  
191 Implemented by wrapping C<poll(POLLOUT)>, as L</syswrite> uses.
192  
193 =cut
194  
195 sub _send1
196 5 ▶{
Subroutine _send1: called CC=2 SCAR=7.5
197 5 my $self = shift;
198 5 my ( $f, $fh, $data, $flags, $to ) = @_;
199  
200 4 ▶ my $waitf = $self->poll( $fh, POLLOUT )->on_done( sub {
Subroutine __ANON__: called CC=6 SCAR=20.2
201 4 my $len;
202 # IO::Socket->send itself might die
203 4 ▶ my $e = eval { $len = $fh->send( $data, $flags, $to ); 1 } ? undef : $@;
Branch: 1 branch
BranchTrueFalseTotal
eval { do { $len = $fh->send($data, $flags, $to); 1 } } ? : 4 0 4
204  
205 4 ▶ if( defined $e ) {
Branch: 3 branches
BranchTrueFalseTotal
if (defined $e) { } 0 4 4
elsif (defined $len) { } 3 1 4
elsif ($! == 11 or $! == 11) { } 0 1 1
206 0 $f->fail( "send: $e\n", send => $fh, $! );
207 }
208 elsif( defined $len ) {
209 3 $f->done( $len );
210 }
211 ▶ elsif( $! == EAGAIN or $! == EWOULDBLOCK ) {
Condition33%1/3
$! == 11 or $! == 11
l!l&&r!l&&!r
001
MC/DC0%0/2
$! == 11 or $! == 11
$! == 11 $! == 11
Truth table33%1/3
A or B
A= $! == 11B= $! == 11
ABresult
1X1
011
000
212 # Try again
213 0 $self->_send1( $f, $fh, $data, $flags, $to );
214 }
215 else {
216 1 $f->fail( "send: $!\n", send => $fh, $! );
217 }
218 5 } );
219  
220 5 ▶ $f //= $waitf->new;
Condition33%1/3
$f //= $waitf->new
l!l&&r!l&&!r
050
MC/DC0%0/2
$f //= $waitf->new
$f $waitf->new
Truth table33%1/3
A //= B
A= $fB= $waitf->new
ABresult
1X1
011
000
221  
222 5 $f->on_cancel( $waitf );
223  
224 5 return $f;
225 }
226  
227 sub send
228 5 ▶{
Subroutine send: called CC=1 SCAR=0.0
Pod documented
229 5 my $self = shift;
230 5 return $self->_send1( undef, @_ );
231 }
232  
233 =head2 sysread
234  
235 Requires a lower-level method
236  
237 $f = $class->poll( $fh, POLLIN );
238  
239 which should return a Future that completes when the given filehandle may be
240 ready for reading.
241  
242 =cut
243  
244 sub _sysread1
245 120 ▶{
Subroutine _sysread1: called CC=2 SCAR=7.1
246 120 my $self = shift;
247 120 my ( $f, $fh, $length ) = @_;
248  
249 117 ▶ my $waitf = $self->poll( $fh, POLLIN )->on_done( sub {
Subroutine __ANON__: called CC=5 SCAR=17.0
250 117 my $ret = $fh->sysread( my $buf, $length );
251 117 ▶ if( $ret ) {
Branch: 3 branches
BranchTrueFalseTotal
if ($ret) { } 13 104 117
elsif (defined $ret) { } 4 100 104
elsif ($! == 11 or $! == 11) { } 100 0 100
252 13 $f->done( $buf );
253 }
254 elsif( defined $ret ) {
255 # EOF
256 4 $f->done();
257 }
258 ▶ elsif( $! == EAGAIN or $! == EWOULDBLOCK ) {
Condition33%1/3
$! == 11 or $! == 11
l!l&&r!l&&!r
10000
MC/DC0%0/2
$! == 11 or $! == 11
$! == 11 $! == 11
Truth table33%1/3
A or B
A= $! == 11B= $! == 11
ABresult
1X1
011
000
259 # Try again
260 100 $self->_sysread1( $f, $fh, $length );
261 }
262 else {
263 0 $f->fail( "sysread: $!\n", sysread => $fh, $! );
264 }
265 120 });
266  
267 120 ▶ $f //= $waitf->new;
Condition66%2/3
$f //= $waitf->new
l!l&&r!l&&!r
100200
MC/DC0%0/2
$f //= $waitf->new
$f $waitf->new
Truth table66%2/3
A //= B
A= $fB= $waitf->new
ABresult
1X1
011
000
268  
269 120 $f->on_cancel( $waitf );
270  
271 120 return $f;
272 }
273  
274 sub sysread
275 20 ▶{
Subroutine sysread: called CC=1 SCAR=0.0
Pod documented
276 20 my $self = shift;
277 20 return $self->_sysread1( undef, @_ );
278 }
279  
280 =head2 syswrite
281  
282 Requires a lower-level method
283  
284 $f = $class->poll( $fh, POLLOUT );
285  
286 which should return a Future that completes when the given filehandle may be
287 ready for writing.
288  
289 =cut
290  
291 sub _syswrite1
292 13 ▶{
Subroutine _syswrite1: called CC=2 SCAR=7.4
293 13 my $self = shift;
294 13 my ( $f, $fh, $data ) = @_;
295  
296 11 ▶ my $waitf = $self->poll( $fh, POLLOUT )->on_done( sub {
Subroutine __ANON__: called CC=4 SCAR=15.2
297 11 my $len = $fh->syswrite( $data );
298 11 ▶ if( defined $len ) {
Branch: 2 branches
BranchTrueFalseTotal
if (defined $len) { } 9 2 11
elsif ($! == 11 or $! == 11) { } 0 2 2
299 9 $f->done( $len );
300 }
301 ▶ elsif( $! == EAGAIN or $! == EWOULDBLOCK ) {
Condition33%1/3
$! == 11 or $! == 11
l!l&&r!l&&!r
002
MC/DC0%0/2
$! == 11 or $! == 11
$! == 11 $! == 11
Truth table33%1/3
A or B
A= $! == 11B= $! == 11
ABresult
1X1
011
000
302 # Try again
303 0 $self->_syswrite1( $f, $fh, $data );
304 }
305 else {
306 2 $f->fail( "syswrite: $!\n", syswrite => $fh, $! );
307 }
308 13 });
309  
310 13 ▶ $f //= $waitf->new;
Condition33%1/3
$f //= $waitf->new
l!l&&r!l&&!r
0130
MC/DC0%0/2
$f //= $waitf->new
$f $waitf->new
Truth table33%1/3
A //= B
A= $fB= $waitf->new
ABresult
1X1
011
000
311  
312 13 $f->on_cancel( $waitf );
313  
314 13 return $f;
315 }
316  
317 sub syswrite
318 13 ▶{
Subroutine syswrite: called CC=1 SCAR=0.0
Pod documented
319 13 my $self = shift;
320 13 return $self->_syswrite1( undef, @_ );
321 }
322  
323 =head1 OPTIONAL METHODS
324  
325 The following methods may be directly provided by an implementation, or they
326 may be emulated by this base class by other means. It is usually better to
327 provide these methods in an implementation if it can do so more efficiently or
328 better in those modules; these emulations are provided as a worst-case
329 fallback and may not be ideal.
330  
331 These methods will require a helper method provided by the implementation
332 class to construct new C<Future> instances of its chosen type.
333  
334 $f = $class->_new_future;
335  
336 =cut
337  
338 =head2 sleep
339  
340 I<Since version 0.22.>
341  
342 Emulated by maintaining a queue of C<sleep> and C<alarm> timers. Two helper
343 methods are provided for the implementation to manage this queue.
344  
345 $timeout = $class->_timeout;
346  
347 $class->_manage_timers;
348  
349 The C<_timeout> method returns a value in seconds to the delay until when the
350 next timer will expire. This may be C<undef> if there are none waiting. The
351 C<_manage_timers> method may be called at any time to invoke any of the timers
352 that have now expired.
353  
354 =cut
355  
356 18 readonly_struct Alarm => [qw( time f )];
357 18 my @alarms;
358 my $cancelled_alarms;
359  
360 sub _timeout
361 4 ▶{
Subroutine _timeout: called CC=5 SCAR=16.4
362 4 shift;
363  
364 4 my $timeout;
365  
366 4 ▶ ( shift @alarms, $cancelled_alarms-- )
Branch: 1 branch
BranchTrueFalseTotal
@alarms and $alarms[0]->f->is_cancelled and do { shift @alarms, --$cancelled_alarms } 1 4 5
Condition66%2/3
@alarms and $alarms[0]->f->is_cancelled
!ll&&!rl&&r
041
MC/DC50%1/2
@alarms and $alarms[0]->f->is_cancelled
@alarms $alarms[0]->f->is_cancelled
Truth table66%2/3
A and B
A= @alarmsB= $alarms[0]->f->is_cancelled
ABresult
0X0
100
111
367 while @alarms and $alarms[0]->f->is_cancelled;
368  
369 4 ▶ if( @alarms ) {
Branch: 1 branch
BranchTrueFalseTotal
if (@alarms) 4 0 4
370 # These are sorted by time order, so head is soonest
371 4 $timeout = $alarms[0]->time - time();
372 4 ▶ $timeout = 0 if $timeout < 0;
Branch: 1 branch
BranchTrueFalseTotal
if $timeout < 0 0 4 4
373 }
374  
375 4 return $timeout;
376 }
377  
378 sub _manage_timers
379 6 ▶{
Subroutine _manage_timers: called CC=4 SCAR=13.9
380 6 shift;
381 6 my $now = time();
382  
383 6 ▶ while( @alarms ) {
Branch: 1 branch
BranchTrueFalseTotal
if (@alarms) 19 2 21
384 19 ▶ last if $alarms[0]->time > $now;
Branch: 1 branch
BranchTrueFalseTotal
if $alarms[0]->time > $now 4 15 19
385  
386 15 my $f = ( shift @alarms )->f;
387  
388 15 ▶ $cancelled_alarms--, next if $f->is_cancelled;
Branch: 1 branch
BranchTrueFalseTotal
if $f->is_cancelled 6 9 15
389 9 $f->done;
390 }
391 }
392  
393 sub _compact_alarms
394 4 ▶{
Subroutine _compact_alarms: called CC=1 SCAR=0.0
395 4 @alarms = grep { !$_->f->is_cancelled } @alarms;
396 4 $cancelled_alarms = 0;
397 }
398  
399 sub sleep
400 112 ▶{
Subroutine sleep: called CC=7 SCAR=19.5
Pod documented
401 112 my $class = shift;
402 112 my ( $secs ) = @_;
403  
404 112 my $time = time() + $secs;
405  
406 112 my $f = $class->_new_future;
407 112 my $alarm = Alarm( $time, $f );
408  
409 112 ▶ if( !@alarms or $time >= $alarms[-1]->time ) {
Branch: 1 branch
BranchTrueFalseTotal
if (not @alarms or $time >= $alarms[-1]->time) { } 109 3 112
Condition100%3/3
not @alarms or $time >= $alarms[-1]->time
l!l&&r!l&&!r
21073
MC/DC100%2/2
not @alarms or $time >= $alarms[-1]->time
not @alarms $time >= $alarms[-1]->time
Truth table100%3/3
not(A) or B
A= not @alarmsB= $time >= $alarms[-1]->time
ABresult
1X1
011
000
410 # Quick path, just push it on the end
411 109 push @alarms, $alarm;
412 }
413 else {
414 # Need to find the right point to splice() it into. It's more likely
415 # that the new alarm goes at the end of the queue so start our search
416 # there.
417 # This isn't a full binary search but a good compromise between fast
418 # performance and simple to write.
419 3 my $idx = $#alarms;
420 3 ▶ $idx = int( $idx/2 ) while $idx > 0 and $alarms[$idx]->time > $time;
Branch: 1 branch
BranchTrueFalseTotal
$idx > 0 and $alarms[$idx]->time > $time and do { $idx = int $idx / 2 } 3 3 6
Condition66%2/3
$idx > 0 and $alarms[$idx]->time > $time
!ll&&!rl&&r
033
MC/DC50%1/2
$idx > 0 and $alarms[$idx]->time > $time
$idx > 0 $alarms[$idx]->time > $time
Truth table66%2/3
A and B
A= $idx > 0B= $alarms[$idx]->time > $time
ABresult
0X0
100
111
421 3 ▶ $idx++ while $idx < @alarms and $alarms[$idx]->time < $time;
Branch: 1 branch
BranchTrueFalseTotal
$idx < @alarms and $alarms[$idx]->time < $time and do { ++$idx } 10 3 13
Condition66%2/3
$idx < @alarms and $alarms[$idx]->time < $time
!ll&&!rl&&r
0310
MC/DC50%1/2
$idx < @alarms and $alarms[$idx]->time < $time
$idx < @alarms $alarms[$idx]->time < $time
Truth table66%2/3
A and B
A= $idx < @alarmsB= $alarms[$idx]->time < $time
ABresult
0X0
100
111
422  
423 3 splice @alarms, $idx, 0, $alarm;
424 }
425  
426 103 ▶ $f->on_cancel( sub {
Subroutine __ANON__: called CC=3 SCAR=11.0
427 103 $cancelled_alarms++;
428  
429 103 ▶ _compact_alarms
Branch: 1 branch
BranchTrueFalseTotal
if $cancelled_alarms >= 5 and $cancelled_alarms > @alarms / 2 4 99 103
Condition100%3/3
$cancelled_alarms >= 5 and $cancelled_alarms > @alarms / 2
!ll&&!rl&&r
23764
MC/DC100%2/2
$cancelled_alarms >= 5 and $cancelled_alarms > @alarms / 2
$cancelled_alarms >= 5 $cancelled_alarms > @alarms / 2
Truth table100%3/3
A and B
A= $cancelled_alarms >= 5B= $cancelled_alarms > @alarms / 2
ABresult
0X0
100
111
430 if $cancelled_alarms >= 5 and $cancelled_alarms > @alarms/2;
431 112 } );
432  
433 112 return $f;
434 }
435  
436 =head1 LEGACY METHODS
437  
438 The following methods are not considered part of the official C<Future::IO>
439 implementation API, and should not be relied upon when writing new code.
440 However, existing code may still exist that uses them so for now they are
441 provided as wrappers.
442  
443 Later versions of this module may start printing deprecation warnings on these
444 methods, so existing code ought to be updated to use the newer forms now.
445  
446 =cut
447  
448 =head2 ready_for_read
449  
450 =head2 ready_for_write
451  
452 $f = $class->ready_for_read( $fh );
453  
454 $f = $class->ready_for_write( $fh );
455  
456 Implemented by wrapping C<poll> by passing in the C<POLLIN> or C<POLLOUT>
457 flags respectively.
458  
459 =cut
460  
461 sub ready_for_read
462 0 ▶{
Subroutine ready_for_read: not called CC=1 SCAR=6.9
Pod documented
463 0 my $self = shift;
464 0 my ( $fh ) = @_;
465  
466 0 return $self->poll( $fh, POLLIN );
467 # TODO: should we check the result before yielding?
468 }
469  
470 sub ready_for_write
471 0 ▶{
Subroutine ready_for_write: not called CC=1 SCAR=6.9
Pod documented
472 0 my $self = shift;
473 0 my ( $fh ) = @_;
474  
475 0 return $self->poll( $fh, POLLOUT );
476 # TODO: should we check the result before yielding?
477 }
478  
479 =head1 AUTHOR
480  
481 Paul Evans <leonerd@leonerd.org.uk>
482  
483 =cut
484  
485 18 0x55AA;
« IO.pm ↑ Summary