有人可以帮帮我吗?我创建了一个Perl脚本来运行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";
}
感谢您的帮助!!
答案 0 :(得分:9)
sudo yum install perl-LWP-Protocol-https
已修复问题。
答案 1 :(得分:6)
正在运行Map<String, Double> result = logLines.stream()
.collect(Collectors.groupingBy(
LogLine::getUri,
TreeMap::new,
Collectors.averagingDouble(LogLine::getRequestDuration)));
为我解决了这个问题。