From b7ea9d2ad986b4a1ac036dc10cd336ce9584d4ce Mon Sep 17 00:00:00 2001 From: dms Date: Thu, 28 Mar 2002 21:12:20 +0000 Subject: [PATCH] - ok, if there are no hits, make sure $num is undefined. git-svn-id: https://svn.code.sf.net/p/infobot/code/trunk@557 c11ca15a-4712-0410-83d8-924469b57eb5 --- blootbot/src/Modules/Dict.pl | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/blootbot/src/Modules/Dict.pl b/blootbot/src/Modules/Dict.pl index 22b6422..b055299 100644 --- a/blootbot/src/Modules/Dict.pl +++ b/blootbot/src/Modules/Dict.pl @@ -31,7 +31,7 @@ sub Dict { # connect. socket($socket, PF_INET, SOCK_STREAM, $proto) or return "error: socket: $!"; eval { - alarm 15; + alarm 10; connect($socket, sockaddr_in($port, inet_aton($server))) or return "error: connect: $!"; alarm 0; }; @@ -57,6 +57,10 @@ sub Dict { my $total = scalar @results; + if ($total == 0) { + $num = undef; + } + if (defined $num and ($num > $total or $num < 1)) { &::msg($::who, "error: choice in definition is out of range."); return; -- 2.39.5