Reputation: 41
I am trying to open a web page in Perl using WWW::Mechanize module. The code for the same is as follows:
use WWW::Mechanize;
my $m = WWW::Mechanize->new();
$url = 'http://www.google.com';
$m->get($url);
print "$m->content()";
When i run this code i get an error like this: Error GETing http://www.google.com :Can't connect to www.google.com:80. What could be the reason for such an error and how can I change my code so that it opens up the webpage specified in the URL.?
Upvotes: 1
Views: 104
Reputation: 185053
There's 2 problems :
the line print "$m->content()";
should be written print $m->content();
: you will get WWW::Mechanize=HASH(0xeca870)->content()
otherwise.
it seems that you have a network or software problem: the rest of your code works.
Upvotes: 2