]> git.donarmstrong.com Git - infobot.git/blobdiff - src/Modules/Math.pl
- I broke maths when I tried to fix "999!" - fixed :-)
[infobot.git] / src / Modules / Math.pl
index d8d4898377c6abe26d1daa0e9af9b70189c0ce8b..c5a1f6bbfc8a8c0793ed754e0d2bdd02fcdb1805 100644 (file)
@@ -110,23 +110,26 @@ sub perlMath {
            $locMsg = sprintf("%1.12f", $locMsg);
            $locMsg =~ s/\.?0+$//;
 
-           if (length($locMsg) > 30) {
+           if (length $locMsg > 30) {
                $locMsg = "a number with quite a few digits...";
            }
        } else {
            if (defined $locMsg) {
                &DEBUG("math: locMsg => '$locMsg'... FIXME");
            } else {
-               $locMsg = "undefined";
+               &status("math: could not really compute.");
+               $locMsg = "";
            }
        }
     } else {
        $locMsg = "";
     }
 
-    if ($locMsg ne $message) {
+    if (defined $locMsg and $locMsg ne $message) {
+       # success.
        return $locMsg;
     } else {
+       # no match.
        return '';
     }
 }