首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何安装LWP::Protocol::https?

如何安装LWP::Protocol::https?
EN

Stack Overflow用户
提问于 2014-01-15 04:44:09
回答 4查看 39.7K关注 0票数 14

我创建了一个Perl脚本来运行https任务。当我运行它时,我得到了错误的LWP::Protocol::https not installed。

我找不到,也找不到关于如何安装LWP::Protocol::http的教程或命令。有人知道怎么安装吗?安装LWP非常简单。

我已经安装了LWPCrypt-SSLeay,但是我仍然收到这个错误。下面是我的代码:

代码语言:javascript
复制
use LWP::UserAgent;

my $ua = LWP::UserAgent->new;


# set custom HTTP request header fields

my $req = HTTP::Request->new(PUT => "https://thesite.com");

$req->header('Authorization' => 'myauth');
$req->header('Accept' => 'JSON:Application/JSON');
$req->header('Content-Type' => 'JSON:Application/JSON');
$req->header('Host' => 'api.thesite.com');

$req->content('Text' => 'thetext');



my $resp = $ua->request($req);
if ($resp->is_success) {
    my $message = $resp->decoded_content;
    print "Received reply: $message\n";
}
else {
    print "HTTP POST error code: ", $resp->code, "\n";
    print "HTTP POST error message: ", $resp->message, "\n";
}
EN

回答 4

Stack Overflow用户

发布于 2018-02-14 16:38:16

sudo yum install perl-LWP-Protocol-https为我修复了这个问题。

票数 21
EN

Stack Overflow用户

发布于 2016-11-04 20:23:21

运行sudo cpan install LWP::Protocol::https为我修复了这个问题。

票数 11
EN

Stack Overflow用户

发布于 2021-11-28 17:42:16

如果您收到此错误:

在@INC中找不到LWP/Protocol/https.pm (@INC包含: /etc/cxs /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 )。在(eval 5)第2行。

您需要安装LWP::Protocol::https,例如使用:

代码语言:javascript
复制
cpan LWP::Protocol::https
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/21123620

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档