in reply to Overcoming image lock WWW::Mechanize

Why don't you download the images using the WWW::Mechanize object you already have? Each WWW::Mechanize object already is-a LWP::UserAgent object, so it doesn't make sense to me to use a different LWP::UserAgent object if you want to save data. Maybe it would also help if you showed the code that doesn't work instead of the code that works.

  • Comment on Re: Overcoming image lock WWW::Mechanize

Replies are listed 'Best First'.
Re^2: Overcoming image lock WWW::Mechanize
by jonnyfolk (Vicar) on Feb 13, 2009 at 11:56 UTC
    Oh, that's what I didn't understand. I changed my $ua to $mech and the images came booming through bright and clear. Thank you very much!!

    Update: Sorry, to be clear, for the record:

    my $mech = WWW::Mechanize->new( cookie_jar => { file => 'cookies.txt', ignore_discard => 1, autosave => 1 } ); $mech->get($add); my @links = $mech->find_all_images(url_regex => qr/jpg/); my $countphotos; for my $img (@links) { $countphotos++; my $photofile ="photo" . $countphotos . '.jpg'; my $a = $img -> url_abs; $mech->mirror( $a, $photofile ); }