http://qs321.pair.com?node_id=283295


in reply to Re: WWW:Mechanize and Windows
in thread WWW:Mechanize and Windows

Hello John, Well all the examples cause the problem from the example.pod file. Here is the shortest one, written by Randal himself. I was running this code to test the module out and that is when I ran into the problem. In other words, I have not even gotten to my own code yet. I have also been unsuccesfull in getting the latest version of this module to install which is why I went to the prior version.
use strict; $|++; use WWW::Mechanize; use File::Basename; my $m = WWW::Mechanize->new; $m->get("http://www.despair.com/indem.html"); my @top_links = @{$m->links}; for my $top_link_num (0..$#top_links) { next unless $top_links[$top_link_num][0] =~ /^http:/; $m->follow($top_link_num) or die "can't follow $top_link_num"; print $m->uri, "\n"; for my $image (grep m{^http://store4}, map $_->[0], @{$m->links}) { my $local = basename $image; print " $image...", $m->mirror($image, $local)->message, "\n" } $m->back or die "can't go back"; }

This is the very line that causes it:
my $m = WWW::Mechanize->new;

Well any help is always appreciated. Thank you very much!

Akira

Replies are listed 'Best First'.
Re: WWW:Mechanize and Windows
by WhiteBird (Hermit) on Aug 13, 2003 at 00:30 UTC
    Using Windows 2000, ActiveState perl v5.6.1 and WWW::Mechanize (version 0.43)-- I cut and pasted your code and it runs perfectly on my system. So, perhaps the problem is in your version of Mechanize, or perhaps you're missing something else on your system. When I run the code through my debugger, it does tap into LWP::UserAgent. Could you have a problem there? (Seems unlikely, but leave no stone unturned.)

    I know this isn't much help. But don't give up hope, the code can work.