This script:
use strict;
use warnings;
use WWW::Mechanize;
my $mech = WWW::Mechanize->new( autocheck => 1 );
$mech->get( "http://www.google.com" );
print $mech->content;
Produces this error message:
Error GETing http://www.google.com : Can't connect to www.google.com:80 (connect: Unknown error) at D:\\PERL\\try.pl line 5
What's wrong?
From your error message I see that you're on a Windows box (D:\\PERL\\try.pl). Maybe the Windows firewall doesn't trust Perl to access the internet and blocks its traffic?
You might get lucky adding a rule allowing perl.exe access to the internet in the Windows firewall.
Did it work before? This code works on my Linux box.
可能像Olfan所说的那样成为防火墙,或者您可能需要在环境中使用代理。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.