我已经安装了Bundle::LWP
,几分钟后我得到了这个
$ perl -MLWP -le "print(LWP->VERSION)"
6.68
听起来不错。但是,运行此脚本
#!/usr/bin/perl
# Example code from Chapter 1 of /Perl and LWP/ by Sean M. Burke
# http://www.oreilly.com/catalog/perllwp/
# [email protected]
require 5;
use strict;
use warnings;
use LWP;
my $browser = LWP::UserAgent->new();
my $response = $browser->get("http://www.oreilly.com/");
die "Couldn't access it: ", $response->status_line
unless $response->is_success;
print $response->header("Server"), "\n";
__END__
给出这个错误:
$ perl a3.pl
Couldn't access it: 501 Protocol scheme 'https' is not supported (LWP::Protocol::https not installed) at a3.pl line 25.
我该如何解决?
您需要安装LWP::Protocol::https Perl 的模块:
或在 Debian 和衍生产品上使用包管理器:
https
这是因为 O'Reilly 现在默认使用重定向来提供页面,请参见curl -v
以下内容: