in reply to LWP and Google

This works just fine:
#!/usr/bin/perl use strict; use WWW::Mechanize; my $browser = WWW::Mechanize->new(); $browser->get('http://www.google.com'); $browser->form_name('f'); $browser->field('q','langley public library'); $browser->submit(); print $browser->content();
I've really come to rely on WWW::Mechanize lately. It's great.


($_='kkvvttuubbooppuuiiffssqqffssmmiibbddllffss')
=~y~b-v~a-z~s; print

Replies are listed 'Best First'.
Re^2: LWP and Google
by petdance (Parson) on Nov 08, 2004 at 17:20 UTC
    I prefer to use the submit_form() method. Also, you need to check for errors, either manually or by setting autocheck.
    #!/usr/bin/perl use strict; use WWW::Mechanize; my $browser = WWW::Mechanize->new( autocheck=>1 ); $browser->get('http://www.google.com'); $browser->submit_form( form_name => 'f', fields => { q => 'langley public library', }, ); print $browser->content();

    xoxo,
    Andy