#!/usr/bin/perl
use AnyEvent;
use AnyEvent::HTTP;
my $cv = AnyEvent->condvar;
sub doit{
my $url = shift ;
return if not defined $url;
$cv->begin;
http_get( "$url",timeout => 20, sub { done( $url, @_ ) } );
print "1111111111111111\n";
}
sub done {
my ($url, $content, $hdr) = @_;
$cv->end();
print "Search: $url\tStatus: ", $hdr->{Status}, "\n";
if ($hdr->{Status}==200)
{
print "\$content is $content\n";
}elsif
($hdr->{Status}==596){
print "time out\n";
}}
&doit('http://120.55.118.6:3000/api/env?ip=192.168.32.101');
print "222222222222222222\n";
print "3333333333333333333\n";
$cv->recv();
~