]> git.donarmstrong.com Git - infobot.git/commitdiff
- Lycos.pm not installed on some machines - can cause "crash". Fixed.
authordms <dms@c11ca15a-4712-0410-83d8-924469b57eb5>
Wed, 3 Jul 2002 17:13:34 +0000 (17:13 +0000)
committerdms <dms@c11ca15a-4712-0410-83d8-924469b57eb5>
Wed, 3 Jul 2002 17:13:34 +0000 (17:13 +0000)
  Bug found by tiri@OPN. Thanks!

git-svn-id: https://svn.code.sf.net/p/infobot/code/trunk/blootbot@559 c11ca15a-4712-0410-83d8-924469b57eb5

src/Modules/W3Search.pl

index 9bbe78c2412146f9ea267e6c0c26ab5f64b230a4..a74cf993c4581e6faa9bdfc433dd74b4137049d0 100644 (file)
@@ -7,7 +7,7 @@ package W3Search;
 use strict;
 use vars qw(@W3Search_engines $W3Search_regex);
 @W3Search_engines = qw(AltaVista Dejanews Excite Gopher HotBot Infoseek
-               Lycos Magellan PLweb SFgate Simple Verity Google);
+               Lycos Magellan PLweb SFgate Simple Verity Google z);
 $W3Search_regex = join '|', @W3Search_engines;
 
 my $maxshow    = 3;
@@ -15,6 +15,7 @@ my $maxshow   = 3;
 sub W3Search {
     my ($where, $what, $type) = @_;
     my $retval = "$where can't find \002$what\002";
+    my $Search;
 
     my @matches = grep { lc($_) eq lc($where) ? $_ : undef } @W3Search_engines;
     if (@matches) {
@@ -26,7 +27,15 @@ sub W3Search {
 
     return unless &::loadPerlModule("WWW::Search");
 
-    my $Search = new WWW::Search($where);
+    eval {
+       $Search = new WWW::Search($where);
+    };
+
+    if (!defined $Search) {
+       &::msg($::who, "$where is invalid search.");
+       return;
+    }
+
     my $Query  = WWW::Search::escape_query($what);
     $Search->native_query($Query,
 #      {