get '/api/test' => sub{
 my $c=shift;
 sleep(10);
 $c->render(text =>"this is test 1229")
};


centos6.5:/root#perl as.pl 
$time1 is 2016-12-29 22:52:33
11111111111111111111

/**************

centos6.5:/root#cat as.pl 
use AnyEvent::HTTP;
use HTTP::Date qw(time2iso str2time time2iso time2isoz);
my $cv = AnyEvent->condvar;
   http_request GET => 'http://192.168.11.185:3000/api/test',timeout => 5, sub {
      my ($body, $hdr) = @_;
      $time2=time2iso(time());
      print "\$time2 is $time2\n";
      print "$body\n";
   };
     $time1=time2iso(time());
      print "\$time1 is $time1\n";
      print "11111111111111111111\n";
$cv->recv();


centos6.5:/root#perl as.pl 
$time1 is 2016-12-29 22:52:33
11111111111111111111


$time2 is 2016-12-29 22:52:38


此时5秒钟就超时不输出了

centos6.5:/root#cat as.pl 
use AnyEvent::HTTP;
use HTTP::Date qw(time2iso str2time time2iso time2isoz);
my $cv = AnyEvent->condvar;
   http_request GET => 'http://192.168.11.185:3000/api/test',timeout => 20, sub {
      my ($body, $hdr) = @_;
      $time2=time2iso(time());
      print "\$time2 is $time2\n";
      print "$body\n";
   };
     $time1=time2iso(time());
      print "\$time1 is $time1\n";
      print "11111111111111111111\n";
$cv->recv();

centos6.5:/root#perl as.pl 
$time1 is 2016-12-29 22:54:14
11111111111111111111
$time2 is 2016-12-29 22:54:24
this is test 1229

此时隔10秒后输出