From 857f3b7001b806dc469cb958d268f920a8017680 Mon Sep 17 00:00:00 2001
From: dms <dms@c11ca15a-4712-0410-83d8-924469b57eb5>
Date: Wed, 3 Jul 2002 17:13:34 +0000
Subject: [PATCH] - Lycos.pm not installed on some machines - can cause
 "crash". Fixed.   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 | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/src/Modules/W3Search.pl b/src/Modules/W3Search.pl
index 9bbe78c..a74cf99 100644
--- a/src/Modules/W3Search.pl
+++ b/src/Modules/W3Search.pl
@@ -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,
 #	{
-- 
2.39.5