How can I make WWW:Mechanize to not fetch pages twice?

Posted by planetp on Stack Overflow See other posts from Stack Overflow or by planetp
Published on 2010-03-25T12:02:41Z Indexed on 2010/03/25 12:33 UTC
Read the original article Hit count: 359

Filed under:
|

I have a web scraping application, written in OO perl. There's single WWW::Mechanize object used in the app. How can I make it to not fetch the same url twice, i.e. make the second get() with the same url nop:

my $mech = WWW::Mechanize->new();
my $url = 'http:://google.com';

$mech->get( $url ); # first time, fetch
$mech->get( $url ); # same url, do nothing

© Stack Overflow or respective owner

Related posts about perl

Related posts about www-mechanize