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.133 by root, Thu Jul 2 23:22:35 2009 UTC vs.
Revision 1.136 by root, Fri Jul 3 21:44:14 2009 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 = 4.45; 19our $VERSION = 4.452;
20 20
21=head1 SYNOPSIS 21=head1 SYNOPSIS
22 22
23 use AnyEvent; 23 use AnyEvent;
24 use AnyEvent::Handle; 24 use AnyEvent::Handle;
245yet. This data will be lost. Calling the C<stoptls> method in time might 245yet. This data will be lost. Calling the C<stoptls> method in time might
246help. 246help.
247 247
248=item peername => $string 248=item peername => $string
249 249
250A string used to identify the remote site - usually the DNS hostname used 250A string used to identify the remote site - usually the DNS hostname
251to create the connection. 251(I<not> IDN!) used to create the connection, rarely the IP address.
252 252
253Apart from being useful in error messages, this string is also used in TLS 253Apart from being useful in error messages, this string is also used in TLS
254common name verification (see C<verify_cn> in L<AnyEvent::TLS>). 254common name verification (see C<verify_cn> in L<AnyEvent::TLS>).
255 255
256=item tls => "accept" | "connect" | Net::SSLeay::SSL object 256=item tls => "accept" | "connect" | Net::SSLeay::SSL object
1216=cut 1216=cut
1217 1217
1218register_read_type json => sub { 1218register_read_type json => sub {
1219 my ($self, $cb) = @_; 1219 my ($self, $cb) = @_;
1220 1220
1221 require JSON; 1221 my $json = $self->{json} ||=
1222 eval { require JSON::XS; JSON::XS->new->utf8 }
1223 || do { require JSON; JSON->new->utf8 };
1222 1224
1223 my $data; 1225 my $data;
1224 my $rbuf = \$self->{rbuf}; 1226 my $rbuf = \$self->{rbuf};
1225
1226 my $json = $self->{json} ||= JSON->new->utf8;
1227 1227
1228 sub { 1228 sub {
1229 my $ref = eval { $json->incr_parse ($self->{rbuf}) }; 1229 my $ref = eval { $json->incr_parse ($self->{rbuf}) };
1230 1230
1231 if ($ref) { 1231 if ($ref) {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines