package WWW::Mechanize::Clones; use strict; use warnings; use Storable 'dclone'; sub WWW::Mechanize::clone { dclone $_[0] } __END__ =head1 NAME WWW::Mechanize::Clones - "fork" browser windows =head1 DESCRIPTION This allows you to "fork" a WWW::Mechanize browser so you can follow multiple links. =head1 SYNOPSIS use WWW::Mechanize; use WWW::Mechanize::Clones; my $browser = WWW::Mechanize->get( ... ); my @browsers = map( { my $new_browser = $browser->clone; $new_browser->follow_link( $_ ); } $browser->find_all_links( ... ) ); =head1 ADDED METHODS =over 4 =item $browser->clone This additional method is added to the WWW::Mechanize class so that you can make a copy of your browser at a point in time. This allows you to follow multiple links from the same page without having to back track. Here is an example of how to do this without this module: $browser->follow_link( ... ); # do some work $browser->back; $browser->follow_link( ... ); And here is how you can how do this. You no longer have to keep track of how many times to use ->back to get back to where you can follow the other link. my $new_browser = $browser->clone; $browser->follow_link( ... ); $new_browser->follow_link( ... ); =back =cut