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.232 by root, Fri Mar 30 03:11:17 2012 UTC vs.
Revision 1.233 by root, Thu Apr 5 06:14:10 2012 UTC

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!"; 16 AE::log 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
170with active (but unsatisfiable) read watchers (C<EPIPE>) or I/O errors. In 170with active (but unsatisfiable) read watchers (C<EPIPE>) or I/O errors. In
171cases where the other side can close the connection at will, it is 171cases where the other side can close the connection at will, it is
172often easiest to not report C<EPIPE> errors in this callback. 172often easiest to not report C<EPIPE> errors in this callback.
173 173
174AnyEvent::Handle tries to find an appropriate error code for you to check 174AnyEvent::Handle tries to find an appropriate error code for you to check
175against, but in some cases (TLS errors), this does not work well. It is 175against, but in some cases (TLS errors), this does not work well.
176recommended to always output the C<$message> argument in human-readable 176
177error messages (it's usually the same as C<"$!">). 177If you report the error to the user, it is recommended to always output
178the C<$message> argument in human-readable error messages (you don't need
179to report C<"$!"> if you report C<$message>).
180
181If you want to react programmatically to the error, then looking at C<$!>
182and comparing it against some of the documented C<Errno> values is usually
183better than looking at the C<$message>.
178 184
179Non-fatal errors can be retried by returning, but it is recommended 185Non-fatal errors can be retried by returning, but it is recommended
180to simply ignore this parameter and instead abondon the handle object 186to simply ignore this parameter and instead abondon the handle object
181when this callback is invoked. Examples of non-fatal errors are timeouts 187when this callback is invoked. Examples of non-fatal errors are timeouts
182C<ETIMEDOUT>) or badly-formatted data (C<EBADMSG>). 188C<ETIMEDOUT>) or badly-formatted data (C<EBADMSG>).
1855 my ($self, $err) = @_; 1861 my ($self, $err) = @_;
1856 1862
1857 return $self->_error ($!, 1) 1863 return $self->_error ($!, 1)
1858 if $err == Net::SSLeay::ERROR_SYSCALL (); 1864 if $err == Net::SSLeay::ERROR_SYSCALL ();
1859 1865
1860 my $err =Net::SSLeay::ERR_error_string (Net::SSLeay::ERR_get_error ()); 1866 my $err = Net::SSLeay::ERR_error_string (Net::SSLeay::ERR_get_error ());
1861 1867
1862 # reduce error string to look less scary 1868 # reduce error string to look less scary
1863 $err =~ s/^error:[0-9a-fA-F]{8}:[^:]+:([^:]+):/\L$1: /; 1869 $err =~ s/^error:[0-9a-fA-F]{8}:[^:]+:([^:]+):/\L$1: /;
1864 1870
1865 if ($self->{_on_starttls}) { 1871 if ($self->{_on_starttls}) {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines