1

我正在使用 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);
4

1 回答 1

0

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

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

于 2012-02-07T10:23:52.177 回答