1 # WWWSearch backend, with queries updating the is-db (optionally)
2 # Uses WWW::Search::Google and WWW::Search
3 # originally Google.pl, drastically altered.
12 my ($where, $what, $type) = @_;
13 my $retval = "$where can't find \002$what\002";
15 return unless &main::loadPerlModule("WWW::Search");
17 my @matches = grep { lc($_) eq lc($where) ? $_ : undef } @main::W3Search_engines;
19 $where = shift @matches;
21 &main::msg($main::who, "i don't know how to check '$where'");
24 my $Search = new WWW::Search($where);
25 my $Query = WWW::Search::escape_query($what);
26 $Search->native_query($Query,
29 # search_parse_debug => 2,
32 $Search->http_proxy($main::param{'httpProxy'}) if (&main::IsParam("httpProxy"));
33 my $max = $Search->maximum_to_retrieve(10); # DOES NOT WORK.
37 ### TODO: don't duplicate hosts. minimize like with the files
39 while ($r = $Search->next_result()) {
41 $Result .= " or ".$r->url();
45 last if ++$count >= $maxshow;
49 $retval = "$where says \002$what\002 is at $Result";
52 &main::performStrictReply($retval);