Reputation: 1099
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?
Upvotes: 1
Views: 1060
Reputation: 47909
Might be your firewall like Olfan said or you might need to have to use a proxy in your environment.
Upvotes: 1
Reputation: 579
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.
Upvotes: 7
Reputation: 5104
Did it work before? This code works on my Linux box.
Upvotes: 3