有人可以帮我吗?我创建了一个Perl脚本来运行https任务。当我运行它时,我得到错误LWP :: Protocol :: https未安装。LWP :: Protocol :: https未安装(如何安装?)
我找不出,或找到一个教程或命令如何安装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";
}
感谢您的帮助!
如果错误告诉您未安装“LWP :: Protocol :: https”,请安装它。 – ThisSuitIsBlackNot
哦,geesh。这是一个糟糕的一天。我需要编辑这个问题。我被如此抓住了,我没有做正确的事情...... – CRAIG
这个问题应该是......如何安装它。我似乎无法在任何地方找到这些信息。 – CRAIG