ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/AnyEvent/t/handle/03_http_req.t
(Generate patch)

Comparing AnyEvent/t/handle/03_http_req.t (file contents):
Revision 1.2 by elmex, Sun Apr 27 19:15:43 2008 UTC vs.
Revision 1.5 by root, Sun Apr 27 20:05:21 2008 UTC

1#!/opt/perl/bin/perl 1#!/opt/perl/bin/perl
2
2use strict; 3use strict;
3use Test::More; 4use Test::More;
5use AnyEvent::Impl::Perl;
4use AnyEvent; 6use AnyEvent;
5use AnyEvent::Socket; 7use AnyEvent::Socket;
6 8
7unless ($ENV{PERL_ANYEVENT_NET_TESTS}) { 9unless ($ENV{PERL_ANYEVENT_NET_TESTS}) {
8 plan skip_all => "PERL_ANYEVENT_NET_TESTS environment variable not set"; 10 plan skip_all => "PERL_ANYEVENT_NET_TESTS environment variable not set";
16my $fbytes; 18my $fbytes;
17my $rbytes; 19my $rbytes;
18 20
19my $ae_sock = 21my $ae_sock =
20 AnyEvent::Socket->new ( 22 AnyEvent::Socket->new (
21 PeerAddr => "www.google.de:80", 23 PeerAddr => "www.google.com:80",
22 on_eof => sub { $cv->broadcast }, 24 on_eof => sub { $cv->broadcast },
23 on_error => sub { 25 on_error => sub {
24 my ($ae_sock) = @_; 26 my ($ae_sock) = @_;
25 diag "error: $!"; 27 diag "error: $!";
26 $cv->broadcast 28 $cv->broadcast
27 }, 29 },
28 on_connect => sub { 30 on_connect => sub {
29 my ($ae_sock, $error) = @_; 31 my ($ae_sock, $error) = @_;
30 if ($error) { diag ("connect error: $!"); return } 32 if ($error) { diag ("connect error: $!"); $cv->broadcast; return }
31 33
32 $ae_sock->read (10, sub { 34 $ae_sock->read (10, sub {
33 my ($ae_sock, $data) = @_; 35 my ($ae_sock, $data) = @_;
34 $fbytes = $data; 36 $fbytes = $data;
35 37

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines