【问题标题】:perl cant connect website due to pac file HTTP::ProxyPAC error由于 pac 文件 HTTP::ProxyPASS 错误,perl 无法连接网站
【发布时间】:2015-08-20 03:08:03
【问题描述】:

我正在使用 HTTP::ProxyPAC 模块从 pac 文件中获取代理。但我得到了错误

“JavaScript 模块和 JS 模块似乎都不可用”

请告诉我如何进行。这是我的代码

use strict;
use warnings;
use LWP::UserAgent;
use HTTP::ProxyPAC;

my $ua = LWP::UserAgent->new( keep_alive => 1);
my $pac = HTTP::ProxyPAC->new( URI->new   ("http://pacfilelocation:8080/pac_file.pac") );
my $res = $pac->find_proxy("https://www.google.com");


if ($res->direct) {
print "No Proxy Needed\n";
} elsif ($res->proxy) {
print "Proxy is: " . $res->proxy . "\n";
$ENV{HTTPS_PROXY} = $res->proxy;
$ENV{HTTP_PROXY} = $res->proxy;
$ua->env_proxy;
}

【问题讨论】:

    标签: perl proxy pac


    【解决方案1】:

    docs of HTTP::ProxyPAC 说:

    如果没有提供 interp 选项,HTTP::ProxyPAC 将首先测试是否安装了 JavaScript,如果安装则使用它。如果没有,它将测试是否安装了 JE,如果安装了则使用它。如果两者都没有安装,新调用将终止并显示错误消息。

    这很清楚。安装cpan模块JavaScript

    【讨论】:

    • 当我尝试安装 javascript 时,它反过来会询问 spidermonkey 相关问题并且无法安装。 “interp”选项是什么意思?请帮帮我。
    • @techie 不幸的是我不知道。我刚刚去为你阅读了文档。
    猜你喜欢
    • 2017-06-15
    • 1970-01-01
    • 2013-03-29
    • 1970-01-01
    • 2021-05-09
    • 1970-01-01
    • 2019-06-08
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多