ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/Coro/Event/Handle.pm
(Generate patch)

Comparing Coro/Event/Handle.pm (file contents):
Revision 1.4 by root, Sun Sep 2 00:54:00 2001 UTC vs.
Revision 1.5 by root, Sun Sep 2 01:03:53 2001 UTC

67Wait until the filehandle is readable or writable (and return true) or 67Wait until the filehandle is readable or writable (and return true) or
68until an error condition happens (and return false). 68until an error condition happens (and return false).
69 69
70=cut 70=cut
71 71
72sub readable { tied(${$_[0]})->readable } 72sub readable { Coro::Handle::FH::readable(tied ${$_[0]}) }
73sub writable { tied(${$_[0]})->writable } 73sub writable { Coro::Handle::FH::writable(tied ${$_[0]}) }
74 74
75=item $fh->readline([$terminator]) 75=item $fh->readline([$terminator])
76 76
77Like the builtin of the same name, but allows you to specify the input 77Like the builtin of the same name, but allows you to specify the input
78record separator in a coroutine-safe manner (i.e. not using a global 78record separator in a coroutine-safe manner (i.e. not using a global
214 $res += $r; 214 $res += $r;
215 last unless $len; 215 last unless $len;
216 } elsif ($! != Errno::EAGAIN) { 216 } elsif ($! != Errno::EAGAIN) {
217 last; 217 last;
218 } 218 }
219 last unless $self->writable; 219 last unless writable $self;
220 } 220 }
221 221
222 return $res; 222 return $res;
223} 223}
224 224
251 $res += $r; 251 $res += $r;
252 last unless $len && $r; 252 last unless $len && $r;
253 } elsif ($! != Errno::EAGAIN) { 253 } elsif ($! != Errno::EAGAIN) {
254 last; 254 last;
255 } 255 }
256 last unless $self->readable; 256 last unless readable $self;
257 } 257 }
258 258
259 return $res; 259 return $res;
260} 260}
261 261
272 return $res; 272 return $res;
273 } 273 }
274 my $r = sysread $self->{fh}, $self->{rb}, 8192, length $self->{rb}; 274 my $r = sysread $self->{fh}, $self->{rb}, 8192, length $self->{rb};
275 if (defined $r) { 275 if (defined $r) {
276 return undef unless $r; 276 return undef unless $r;
277 } elsif ($! != Errno::EAGAIN || !$self->readable) { 277 } elsif ($! != Errno::EAGAIN || !readable $self) {
278 return undef; 278 return undef;
279 } 279 }
280 } 280 }
281} 281}
282 282

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines