]> git.donarmstrong.com Git - infobot.git/commitdiff
- AUTOLOAD to ignore __
authordms <dms@c11ca15a-4712-0410-83d8-924469b57eb5>
Wed, 10 Jan 2001 14:54:03 +0000 (14:54 +0000)
committerdms <dms@c11ca15a-4712-0410-83d8-924469b57eb5>
Wed, 10 Jan 2001 14:54:03 +0000 (14:54 +0000)
- use eval on 'require'.

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

src/modules.pl

index 7bee1c5fd8d730e2bdbc249b032f3aaac03b067a..3c52c0f20d46a4973d38dea7fed6e7484f87c99d 100644 (file)
@@ -60,8 +60,13 @@ sub loadCoreModules {
        next unless $file =~ /\.pl$/;
        next unless $file =~ /^[A-Z]/;
        my $mod = "$bot_src_dir/$file";
+
        ### TODO: use eval and exit gracefully?
-       require $mod;
+       eval "require \"$mod\"";
+       if ($@) {
+           &WARN("lCM => $@");
+       }
+
        $moduleAge{$mod} = (stat $mod)[9];
        &showProc(" ($file)") if (&IsParam("DEBUG"));
     }
@@ -121,7 +126,11 @@ sub loadFactoidsModules {
        next unless $file =~ /^[A-Z]/;
        my $mod = "$bot_src_dir/Factoids/$file";
        ### TODO: use eval and exit gracefully?
-       require $mod;
+       eval "require \"$mod\"";
+       if ($@) {
+           &WARN("lFM: $@");
+       }
+
        $moduleAge{$mod} = (stat $mod)[9];
        &showProc(" ($file)") if (&IsParam("DEBUG"));
     }
@@ -331,6 +340,8 @@ if ($@) {
 &showProc(" (Time::HiRes)");
 
 sub AUTOLOAD {
+    return if ($AUTOLOAD =~ /__/);     # internal.
+
     &ERROR("UNKNOWN FUNCTION CALLED: $AUTOLOAD");
     foreach (@_) {
        next unless (defined $_);