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

Comparing AnyEvent/lib/AnyEvent/Handle.pm (file contents):
Revision 1.47 by root, Thu May 29 00:25:28 2008 UTC vs.
Revision 1.51 by root, Sat May 31 13:38:01 2008 UTC

14 14
15AnyEvent::Handle - non-blocking I/O on file handles via AnyEvent 15AnyEvent::Handle - non-blocking I/O on file handles via AnyEvent
16 16
17=cut 17=cut
18 18
19our $VERSION = '0.04'; 19our $VERSION = 4.1;
20 20
21=head1 SYNOPSIS 21=head1 SYNOPSIS
22 22
23 use AnyEvent; 23 use AnyEvent;
24 use AnyEvent::Handle; 24 use AnyEvent::Handle;
329 # now or in the past already? 329 # now or in the past already?
330 if ($after <= 0) { 330 if ($after <= 0) {
331 $self->{_activity} = $NOW; 331 $self->{_activity} = $NOW;
332 332
333 if ($self->{on_timeout}) { 333 if ($self->{on_timeout}) {
334 $self->{on_timeout}->($self); 334 $self->{on_timeout}($self);
335 } else { 335 } else {
336 $! = Errno::ETIMEDOUT; 336 $! = Errno::ETIMEDOUT;
337 $self->error; 337 $self->error;
338 } 338 }
339 339
445 @_ = ($WH{$type} or Carp::croak "unsupported type passed to AnyEvent::Handle::push_write") 445 @_ = ($WH{$type} or Carp::croak "unsupported type passed to AnyEvent::Handle::push_write")
446 ->($self, @_); 446 ->($self, @_);
447 } 447 }
448 448
449 if ($self->{filter_w}) { 449 if ($self->{filter_w}) {
450 $self->{filter_w}->($self, \$_[0]); 450 $self->{filter_w}($self, \$_[0]);
451 } else { 451 } else {
452 $self->{wbuf} .= $_[0]; 452 $self->{wbuf} .= $_[0];
453 $self->_drain_wbuf; 453 $self->_drain_wbuf;
454 } 454 }
455} 455}
661 delete $self->{_rw}; 661 delete $self->{_rw};
662 return; 662 return;
663 } 663 }
664 } 664 }
665 665
666 if ($self->{_eof}) {
667 $self->_shutdown;
668 $self->{on_eof}($self) 666 $self->{on_eof}($self)
669 if $self->{on_eof}; 667 if $self->{_eof} && $self->{on_eof};
670 }
671} 668}
672 669
673=item $handle->on_read ($cb) 670=item $handle->on_read ($cb)
674 671
675This replaces the currently set C<on_read> callback, or clears it (when 672This replaces the currently set C<on_read> callback, or clears it (when
1056 1053
1057 if ($len > 0) { 1054 if ($len > 0) {
1058 $self->{_activity} = AnyEvent->now; 1055 $self->{_activity} = AnyEvent->now;
1059 1056
1060 $self->{filter_r} 1057 $self->{filter_r}
1061 ? $self->{filter_r}->($self, $rbuf) 1058 ? $self->{filter_r}($self, $rbuf)
1062 : $self->_drain_rbuf; 1059 : $self->_drain_rbuf;
1063 1060
1064 } elsif (defined $len) { 1061 } elsif (defined $len) {
1065 delete $self->{_rw}; 1062 delete $self->{_rw};
1066 $self->{_eof} = 1; 1063 $self->{_eof} = 1;
1122call and can be used or changed to your liking. Note that the handshake 1119call and can be used or changed to your liking. Note that the handshake
1123might have already started when this function returns. 1120might have already started when this function returns.
1124 1121
1125=cut 1122=cut
1126 1123
1127# TODO: maybe document...
1128sub starttls { 1124sub starttls {
1129 my ($self, $ssl, $ctx) = @_; 1125 my ($self, $ssl, $ctx) = @_;
1130 1126
1131 $self->stoptls; 1127 $self->stoptls;
1132 1128

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines