New Novice has asked for the wisdom of the Perl Monks concerning the following question:

Hi,

outing myself: as a Windows user (I know, I know,..) I would like to use WWW::Mechanize. Problem: it doesn't work (spend all day re-installing it, only to find http://ppm.activestate.com/BuildStatus/5.8-W.html). Is there an equivalent package that also works under windows (I am using the activeperl distribution)?

Thanks!

Replies are listed 'Best First'.
Re: WWW::Mechanize 1.04 for Windows
by dws (Chancellor) on Nov 26, 2004 at 18:00 UTC

    Get the .tar.gz of WWW::Mechanize from here and unzip it into c:\perl\site\lib\WWW\ and you're off and running. It'll install more than you need, but you can trim off the test files and extraneous stuff.

      That'S what I did. But when I run a programme (see below) that uses the uri-routine, I get the following response: "Can't locate object method uri via WWW::Mechanize::Link". Furthermore, 9 tests and 14 subtests of nmake test were skipped.
      #!/usr/bin/perl -w use strict; use WWW::Mechanize; my $agent = WWW::Mechanize->new(); $agent->get("http://europa.eu.int/prelex/rech_avancee.cfm?CL=en"); die "Can't even get the home page: ", $agent->response->status_line un +less $agent->success; $agent->form(2); $agent->field("clef2", "1999"); $agent->field("clef1", 'COM'); $agent->field("nbr_element", '99'); $agent->click(); my $input=$agent->content(); my @links = grep { $_->uri =~ m!liste_resultats! } $agent->links; foreach my $link (@links) { print "Retrieving $link\n"; $agent->follow( $link ); print $agent->content; $agent->back; };

        And a very appropriate response it is, seeing as how WWW::Mechanize::Link has methods named url and URI, but none named uri.

        WWW::Mechanize::Link pod

        Why do you think installation of WWW::Mechanize failed? The error you encounter is a runtime error at line 13 of your script. That implies that all the calls to that module above it, have actually succeeded — or at least, not made the module barf. Heck, even the $agent->links call, on the right of your grep block, must have returned some values or you wouldn't have gotten this far.

        And ikegami pinpointed the cause of your problem. A non-existing method name, that's a runtime error, as methods can even be created (by AUTOLOAD) on the fly.

        Conclusion: unless the exact same script works on another computer, and I sincerely doubt that, the module most likely will have been properly installed.

Re: WWW::Mechanize 1.04 for Windows
by Arunbear (Prior) on Nov 26, 2004 at 20:27 UTC
      I'm afraid that the activeperl windows distribution does not "support" IE::Mechnize (or a more recent WWW::Mechanize version). That seems to be the problem. But thanks for the hint.

        As ]dws] already detailed, you can install WWW::Mechanize manually by the process he described. Another process would be to:

        1. Download nmake.exe from Microsoft
        2. Unpack the archive
        3. Copy all files from the archive into the same directory that Perl resides in
        4. Open a command prompt
        5. Type perl -MCPAN -e "install 'WWW::Mechanize'"
        6. into it
        7. Press Enter
        8. Press Enter if CPAN wants to configure itself, accept all defaults
        9. Done