LWP读取失败错误

时间:2012-01-29 16:55:42

标签: perl lwp-useragent

我使用LWP :: UserAgent做一个简单的HTTP Post并得到以下错误。经过大量的在线搜索后,似乎有一段时间的错误被修复了。我的6.03版本应该修复。关于为什么会发生这种情况的任何想法?

'_content' => 'read failed:  at /usr/local/share/perl/5.10.1/Net/HTTP/Methods.pm line 256
 at /usr/local/lib/perl/5.10.1/Net/SSL.pm line 211
        Net::SSL::die_with_error(\'LWP::Protocol::https::Socket=GLOB(0x8d9aa38)\', \'read failed\') called at /usr/local/lib/perl/5.10.1/Net/SSL.pm line 224
        Net::SSL::read(\'LWP::Protocol::https::Socket=GLOB(0x8d9aa38)\', \'\', 1024, 0) called at /usr/local/share/perl/5.10.1/Net/HTTP/Methods.pm line 256
        Net::HTTP::Methods::my_readline(\'LWP::Protocol::https::Socket=GLOB(0x8d9aa38)\', \'Status\') called at /usr/local/share/perl/5.10.1/Net/HTTP/Methods.pm line 343
        Net::HTTP::Methods::read_response_headers(\'LWP::Protocol::https::Socket=GLOB(0x8d9aa38)\', \'laxed\', 1, \'junk_out\', \'ARRAY(0x8cd3d98)\') called at /usr/local/share/perl/5.10.1/LWP/Protocol/http.pm line 378

以下是代码示例:

use LWP::UserAgent;
use Data::Dumper;

my $ua = LWP::UserAgent->new;
$ua->timeout(10);
$ua->env_proxy;

my $response = $ua->get('https://metacpan.org/module/LWP::UserAgent');
print Dumper($response);

1 个答案:

答案 0 :(得分:0)

确保你有最新版本的IO::Socket::SSL所需的版本(1.38)是不够的(我刚刚安装了1.54,似乎工作正常)。

https://metacpan.org/source/GAAS/LWP-Protocol-https-6.03/Makefile.PL - 现在已经发布了依赖1.54的内容 - 所以希望能够解决问题。