2

Im using HTTP::ProxyPAC module to get the proxy from pac file. but i get the error

"neither the JavaScript module nor the JS module seems to be available"

please let me know how to proceed. here is my code

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;
}
Techie
  • 21
  • 3

1 Answers1

0

The docs of HTTP::ProxyPAC say:

If no interp option is provided, HTTP::ProxyPAC will first test whether JavaScript is installed, and use it if so. If not it will test whether JE is installed, and use it if so. If neither is installed, the new call will die with an error message.

This is quite clear. Install the cpan module JavaScript.

simbabque
  • 53,749
  • 8
  • 73
  • 136
  • when i tried to install javascript it inturn asks for spidermonkey related questions and fails to install. what is meant by "interp" option? please help me on it. – Techie Jun 05 '15 at 10:31
  • @techie I have no idea unfortunately. I just went and read the docs for you. – simbabque Jun 06 '15 at 09:34