Subject: | WWW::Search::Google never returns results |
First, the default 'User-Agent:' header is rejected outright by Google. The program below replaces this with 'Lynx' to work-around this.
Soecndly, although ethereal and a dump of the $search object shows results coming back, neither the next_result method nor the results method return anything. (uncomment the lines containing '@results' to see the failure of the results method).
Test code:
#!/usr/bin/perl -w
use Data::Dumper;
use WWW::Search;
my $Search = new WWW::Search('Google'); # cAsE matters
my $Query = WWW::Search::escape_query(q["Where is Jimbo"]);
$Search->{agent_name} = 'Lynx';
$Search->native_query($Query);
# @results = $Search->results();
# print Data::Dumper->Dump( [\@results], [qw(*results)]);
while (my $Result = $Search->next_result())
{
print $Result->url, "\n";
}
print Data::Dumper->Dump( [$Search], [qw(*Search)]);
__END__
Tried on 2 different systems:
Redhat 6.0 perl version 5.005_03 built for i386-linux
and
Redhat 7.2, perl v5.6.0 built for i386-linux
$WWW::Search::VERSION\n = 2.33
$WWW::Search::Google::VERSION = 2.21
on both systems.