【发布时间】:2012-05-22 05:03:34
【问题描述】:
我正在使用 Perl 库 HTTP::Async 如下:
use strict;
use warnings;
use HTTP::Async;
use Time::HiRes;
...
my $async = HTTP::Async->new( ... );
my $request = HTTP::Request->new( GET => $url );
my $start = [Time::HiRes::gettimeofday()];
my $id = $async->add($request);
my $response = undef;
while (!$response) {
$response = $async->wait_for_next_response(1);
last if Time::HiRes::tv_interval($start) > TIME_OUT;
}
...
当while 循环超时并且脚本结束时,我遇到以下错误消息:
HTTP::Async object destroyed but still in use at script.pl line 0
HTTP::Async INTERNAL ERROR: 'id_opts' not empty at script.pl line 0
我有哪些选择?如果仍在使用但不再需要,我如何“清理”HTTP::Async 对象?
【问题讨论】:
-
请注意
remove和remove_all已添加到 HTTP::Async -
感谢@ikegami 的更新...
标签: perl http asynchronous timeout