我创建了一个Perl脚本来运行https任务。当我运行它时,我得到了错误的LWP::Protocol::https not installed。
我找不到,也找不到关于如何安装LWP::Protocol::http的教程或命令。有人知道怎么安装吗?安装LWP非常简单。
我已经安装了LWP和Crypt-SSLeay,但是我仍然收到这个错误。下面是我的代码:
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";
}发布于 2018-02-14 16:38:16
sudo yum install perl-LWP-Protocol-https为我修复了这个问题。
发布于 2016-11-04 20:23:21
运行sudo cpan install LWP::Protocol::https为我修复了这个问题。
发布于 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,例如使用:
cpan LWP::Protocol::httpshttps://stackoverflow.com/questions/21123620
复制相似问题