From: dms Date: Wed, 10 Jan 2001 14:54:03 +0000 (+0000) Subject: - AUTOLOAD to ignore __ X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=1b603206270411f512663919a31cf535d08339c6;p=infobot.git - AUTOLOAD to ignore __ - use eval on 'require'. git-svn-id: https://svn.code.sf.net/p/infobot/code/trunk@233 c11ca15a-4712-0410-83d8-924469b57eb5 --- diff --git a/blootbot/src/modules.pl b/blootbot/src/modules.pl index 7bee1c5..3c52c0f 100644 --- a/blootbot/src/modules.pl +++ b/blootbot/src/modules.pl @@ -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 $_);