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.6 by elmex, Thu May 15 14:12:24 2008 UTC vs.
Revision 1.8 by root, Fri May 23 17:47:06 2008 UTC

1#!/opt/perl/bin/perl 1#!/opt/perl/bin/perl
2
2use strict; 3use strict;
4
3use AnyEvent::Impl::Perl; 5use AnyEvent::Impl::Perl;
4use AnyEvent; 6use AnyEvent;
5use AnyEvent::Socket; 7use AnyEvent::Socket;
8use AnyEvent::Handle;
6 9
7unless ($ENV{PERL_ANYEVENT_NET_TESTS}) { 10unless ($ENV{PERL_ANYEVENT_NET_TESTS}) {
8 print "1..0 # Skip PERL_ANYEVENT_NET_TESTS environment variable not set\n"; 11 print "1..0 # Skip PERL_ANYEVENT_NET_TESTS environment variable not set\n";
9 exit 0; 12 exit 0;
10} 13}
14my $cv = AnyEvent->condvar; 17my $cv = AnyEvent->condvar;
15 18
16my $rbytes; 19my $rbytes;
17 20
18my $hdl; 21my $hdl;
19my $wo = AnyEvent::Util::tcp_connect ('www.google.com', 80, sub { 22my $wo = tcp_connect 'www.google.com', 80, sub {
20 my ($sock) = @_; 23 my ($sock) = @_;
21 $hdl = 24 $hdl =
22 AnyEvent::Handle->new ( 25 AnyEvent::Handle->new (
23 fh => $sock, 26 fh => $sock,
24 on_error => sub { 27 on_error => sub {
55 }); 58 });
56 }); 59 });
57 60
58 $hdl->push_write ("GET http://www.google.com/ HTTP/1.0\015\012\015\012"); 61 $hdl->push_write ("GET http://www.google.com/ HTTP/1.0\015\012\015\012");
59 62
60}, sub { 63};
61 warn "error on connect: $!";
62}, 10);
63 64
64$cv->wait; 65$cv->wait;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines