… | |
… | |
714 | my $handle; # avoid direct assignment so on_eof has it in scope. |
714 | my $handle; # avoid direct assignment so on_eof has it in scope. |
715 | $handle = new AnyEvent::Handle |
715 | $handle = new AnyEvent::Handle |
716 | fh => $fh, |
716 | fh => $fh, |
717 | on_error => sub { |
717 | on_error => sub { |
718 | warn "error $_[2]\n"; |
718 | warn "error $_[2]\n"; |
|
|
719 | $_[0]->destroy; |
719 | }, |
720 | }, |
720 | on_eof => sub { |
721 | on_eof => sub { |
721 | $handle->destroy; # destroy handle |
722 | $handle->destroy; # destroy handle |
722 | warn "done.\n"; |
723 | warn "done.\n"; |
723 | }; |
724 | }; |