1 # W3Search drastically altered back to GoogleSearch as Search::Google
2 # was deprecated and requires a key that google no longer provides.
3 # This new module uses REST::Google::Search
4 # Modified by db <db@cave.za.net> 12-01-2008.
13 my ( $what, $type ) = @_;
15 my $retval = "$where can't find \002$what\002";
18 return unless &::loadPerlModule("REST::Google::Search");
20 REST::Google::Search->http_referer('http://infobot.sourceforge.net/');
21 $Search = REST::Google::Search->new( q => $what );
23 if ( !defined $Search ) {
24 &::msg( $::who, "$where is invalid search." );
28 if ( $Search->responseStatus != 200 ) {
29 &::msg( $::who, "http error returned." );
33 my $data = $Search->responseData;
34 my $cursor = $data->cursor;
35 my @results = $data->results;
38 $retval = "$where says \002$what\002 is at ";
39 foreach my $r (@results) {
41 $retval .= ' or ' if ( $count > 0 );
43 last if ++$count >= $maxshow;
46 &::performStrictReply($retval);
51 # vim:ts=4:sw=4:expandtab:tw=80