Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re^7: fetching and storing data from web.

by chessgui (Scribe)
on Jan 27, 2012 at 13:38 UTC ( #950368=note: print w/ replies, xml ) Need Help??


in reply to Re^6: fetching and storing data from web.
in thread fetching and storing data from web.

I've just googled the english part of the error message and it turned out that this is a typical problem for lamers: it is not enough to install the mozrepl extension but you have to explicitly run it or set the option 'Activate on startup' :). Now I'm able to open a web page. But it is still not clear how to use this module to submit a form or login to some site. Is there any tutorial on this that you recommend?


Comment on Re^7: fetching and storing data from web.
Re^8: fetching and storing data from web.
by choroba (Abbot) on Jan 27, 2012 at 14:05 UTC
      Thanks. By reworking one of the examples I was able to put together a code which opens the Firefox browser, loads the CPAN search page, fills in the query field with 'WWW::Mechanize' and then submits the form:
      #!/usr/bin/perl use strict; use warnings; # the module we're looking for my $module_name = 'WWW::Mechanize'; # create a new browser use WWW::Mechanize::Firefox; my $browser = WWW::Mechanize::Firefox->new( launch => 'C:/Program Files/Mozilla Firefox/firefox.exe',tab=>'cur +rent' ); # tell it to get the main page $browser->get("http://search.cpan.org/"); # submit the query form $browser->submit_form(with_fields=>{query=>$module_name});
Re^8: fetching and storing data from web.
by Corion (Pope) on Jan 27, 2012 at 14:46 UTC
      It took me two hours to build the module on Win32. I got so frustrated that I've just put the name of the module to the search engine in the hope to get something working. If I do a proper search the first hit is the examples page you mentioned so no problem there.

      By the way grats for your module: it is really business like. Automatically looking up the form suitable for the given fields is really handy. I know what I mean: I parse forms manually from web pages and when the structure of the page changes ( form 5 suddenly becomes form 4 ) the whole application fails.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://950368]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (7)
As of 2014-12-18 02:57 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (41 votes), past polls