… | |
… | |
11 | |
11 | |
12 | my $hdl; $hdl = new AnyEvent::Handle |
12 | my $hdl; $hdl = new AnyEvent::Handle |
13 | fh => \*STDIN, |
13 | fh => \*STDIN, |
14 | on_error => sub { |
14 | on_error => sub { |
15 | my ($hdl, $fatal, $msg) = @_; |
15 | my ($hdl, $fatal, $msg) = @_; |
16 | AE::log error => "got error $msg\n"; |
16 | AE::log error => "Got error $msg!"; |
17 | $hdl->destroy; |
17 | $hdl->destroy; |
18 | $cv->send; |
18 | $cv->send; |
19 | }; |
19 | }; |
20 | |
20 | |
21 | # send some request line |
21 | # send some request line |
… | |
… | |
2336 | C<low_water_mark> this will be called precisely when all data has been |
2336 | C<low_water_mark> this will be called precisely when all data has been |
2337 | written to the socket: |
2337 | written to the socket: |
2338 | |
2338 | |
2339 | $handle->push_write (...); |
2339 | $handle->push_write (...); |
2340 | $handle->on_drain (sub { |
2340 | $handle->on_drain (sub { |
2341 | AE::log debug => "all data submitted to the kernel\n"; |
2341 | AE::log debug => "All data submitted to the kernel."; |
2342 | undef $handle; |
2342 | undef $handle; |
2343 | }); |
2343 | }); |
2344 | |
2344 | |
2345 | If you just want to queue some data and then signal EOF to the other side, |
2345 | If you just want to queue some data and then signal EOF to the other side, |
2346 | consider using C<< ->push_shutdown >> instead. |
2346 | consider using C<< ->push_shutdown >> instead. |