… | |
… | |
83 | waiting for data. |
83 | waiting for data. |
84 | |
84 | |
85 | =item on_error => $cb->($self) |
85 | =item on_error => $cb->($self) |
86 | |
86 | |
87 | This is the fatal error callback, that is called when, well, a fatal error |
87 | This is the fatal error callback, that is called when, well, a fatal error |
88 | ocurs, such as not being able to resolve the hostname, failure to connect |
88 | occurs, such as not being able to resolve the hostname, failure to connect |
89 | or a read error. |
89 | or a read error. |
90 | |
90 | |
91 | The object will not be in a usable state when this callback has been |
91 | The object will not be in a usable state when this callback has been |
92 | called. |
92 | called. |
93 | |
93 | |
… | |
… | |
102 | |
102 | |
103 | This sets the default read callback, which is called when data arrives |
103 | This sets the default read callback, which is called when data arrives |
104 | and no read request is in the queue. |
104 | and no read request is in the queue. |
105 | |
105 | |
106 | To access (and remove data from) the read buffer, use the C<< ->rbuf >> |
106 | To access (and remove data from) the read buffer, use the C<< ->rbuf >> |
107 | method or acces sthe C<$self->{rbuf}> member directly. |
107 | method or access the C<$self->{rbuf}> member directly. |
108 | |
108 | |
109 | When an EOF condition is detected then AnyEvent::Handle will first try to |
109 | When an EOF condition is detected then AnyEvent::Handle will first try to |
110 | feed all the remaining data to the queued callbacks and C<on_read> before |
110 | feed all the remaining data to the queued callbacks and C<on_read> before |
111 | calling the C<on_eof> callback. If no progress can be made, then a fatal |
111 | calling the C<on_eof> callback. If no progress can be made, then a fatal |
112 | error will be raised (with C<$!> set to C<EPIPE>). |
112 | error will be raised (with C<$!> set to C<EPIPE>). |
… | |
… | |
250 | for reading. |
250 | for reading. |
251 | |
251 | |
252 | The write queue is very simple: you can add data to its end, and |
252 | The write queue is very simple: you can add data to its end, and |
253 | AnyEvent::Handle will automatically try to get rid of it for you. |
253 | AnyEvent::Handle will automatically try to get rid of it for you. |
254 | |
254 | |
255 | When data could be writtena nd the write buffer is shorter then the low |
255 | When data could be written and the write buffer is shorter then the low |
256 | water mark, the C<on_drain> callback will be invoked. |
256 | water mark, the C<on_drain> callback will be invoked. |
257 | |
257 | |
258 | =over 4 |
258 | =over 4 |
259 | |
259 | |
260 | =item $handle->on_drain ($cb) |
260 | =item $handle->on_drain ($cb) |
… | |
… | |
488 | Append the given callback to the end of the queue (C<push_read>) or |
488 | Append the given callback to the end of the queue (C<push_read>) or |
489 | prepend it (C<unshift_read>). |
489 | prepend it (C<unshift_read>). |
490 | |
490 | |
491 | The callback is called each time some additional read data arrives. |
491 | The callback is called each time some additional read data arrives. |
492 | |
492 | |
493 | It must check wether enough data is in the read buffer already. |
493 | It must check whether enough data is in the read buffer already. |
494 | |
494 | |
495 | If not enough data is available, it must return the empty list or a false |
495 | If not enough data is available, it must return the empty list or a false |
496 | value, in which case it will be called repeatedly until enough data is |
496 | value, in which case it will be called repeatedly until enough data is |
497 | available (or an error condition is detected). |
497 | available (or an error condition is detected). |
498 | |
498 | |