theloanarranger has asked for the wisdom of the Perl Monks concerning the following question:
Here is my error from the script:#!/usr/local/bin/perl -w use strict; use URI; use LWP; foreach my $word (@ARGV) { next unless length $word; # sanity-check my ($content, $status, $is_success) = &do_GET($word); if (!$is_success) { print "Sorry, failed: $status\n"; } elsif ($content =~ /\sof\sabout\s<b>([\d,]+)<\/b>/) { print "$word: $1 matches\n"; } else { print "$word: page not processable\n"; } sleep 2; #being nice to googles server } my $browser; sub do_GET { $browser = LWP::UserAgent->new() unless $browser; $browser->agent('Mozilla/5.0'); my $uri = URI->new('http://www.google.com/search'); $uri->query_form('q' => $_[0]); my $resp = $browser->simple_request (GET $uri); #THIS IS LINE 34 return ($resp->content, $resp->status_line, $resp->is_success, $re +sp) if wantarray; return unless $resp->is_success; return $resp->content; }
TiB17:~/scripts/perl/lwp theloanarranger$ 2-6 friend Can't locate object method "GET" via package "URI::http" at /Users/the +loanarranger/scripts/perl/lwp/2-6 line 34.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: screen scraping google
by tachyon (Chancellor) on Jul 15, 2004 at 01:41 UTC | |
by inman (Curate) on Jul 15, 2004 at 08:21 UTC | |
by tachyon (Chancellor) on Jul 15, 2004 at 11:01 UTC | |
by Anonymous Monk on Jul 15, 2004 at 11:50 UTC | |
by belden (Friar) on Jul 15, 2004 at 19:30 UTC | |
|
Re: screen scraping google
by borisz (Canon) on Jul 15, 2004 at 01:14 UTC | |
|
Re: screen scraping google
by beable (Friar) on Jul 15, 2004 at 00:49 UTC | |
by rob_au (Abbot) on Jul 15, 2004 at 01:19 UTC | |
by Rhandom (Curate) on Jul 15, 2004 at 15:37 UTC |