"kernel" => "Kernel.pl",
"ircdcc" => "UserDCC.pl",
"perlMath" => "Math.pl",
+ "news" => "News.pl",
"quote" => "Quote.pl",
"rootwarn" => "RootWarn.pl",
"search" => "Search.pl",
"wingate" => "Wingate.pl",
"insult" => "insult.pl",
"nickometer" => "nickometer.pl",
+ "babelfish" => "babel.pl",
);
-@myModulesLoadNow = ('topic', 'uptime',);
-@myModulesReloadNot = ('IRC/Irc.pl','IRC/Schedulers.pl');
+### THIS IS NOT LOADED ON RELOAD :(
+BEGIN {
+ @myModulesLoadNow = ('topic', 'uptime', 'news');
+ @myModulesReloadNot = ('IRC/Irc.pl','IRC/Schedulers.pl');
+}
sub loadCoreModules {
if (!opendir(DIR, $bot_src_dir)) {
exit 1;
}
- &status("Loading CORE modules...");
-
+ my @mods;
while (defined(my $file = readdir DIR)) {
next unless $file =~ /\.pl$/;
next unless $file =~ /^[A-Z]/;
- my $mod = "$bot_src_dir/$file";
+ push(@mods, $file);
+ }
+ closedir DIR;
+ &status("Loading ".scalar(@mods)." CORE modules...");
+
+ foreach (sort @mods) {
+ my $mod = "$bot_src_dir/$_";
- ### TODO: use eval and exit gracefully?
eval "require \"$mod\"";
if ($@) {
&ERROR("lCM => $@");
}
$moduleAge{$mod} = (stat $mod)[9];
- &showProc(" ($file)") if (&IsParam("DEBUG"));
+ &showProc(" ($_)") if (&IsParam("DEBUG"));
}
- closedir DIR;
}
sub loadDBModules {
next;
}
- if (!&IsParam($_) and !&IsChanConf($_)) {
+ if (!&IsParam($_) and !&IsChanConf($_) and !&getChanConfList($_)) {
if (exists $myModules{$_}) {
- &DEBUG("myModule: $myModules{$_} (1) not loaded.");
+ &status("myModule: $myModules{$_} or $_ (1) not loaded.");
} else {
&DEBUG("myModule: $_ (2) not loaded.");
}
$loaded++;
}
- &status("Module: Loaded/Total [$loaded/$total]");
+ &status("Module: Runtime: Loaded/Total [$loaded/$total]");
}
### rename to moduleReloadAll?
return;
}
- my $age = (stat $file)[9];
- return if ($age == $moduleAge{$file});
-
- if ($age < $moduleAge{$file}) {
- &WARN("rM: we're not gonna downgrade the file. use 'touch'.");
- return;
- }
-
if (grep /$mod/, @myModulesReloadNot) {
&DEBUG("rM: SHOULD NOT RELOAD $mod!!!");
return;
}
- my $dc = &Time2String($age - $moduleAge{$file});
- my $ago = &Time2String(time() - $moduleAge{$file});
+ my $age = (stat $file)[9];
+
+ if (!exists $moduleAge{$file}) {
+ &DEBUG("Looks like $file was not loaded; fixing.");
+ } else {
+ return if ($age == $moduleAge{$file});
+
+ if ($age < $moduleAge{$file}) {
+ &WARN("rM: we're not gonna downgrade the file. use 'touch'.");
+ return;
+ }
+
+ my $dc = &Time2String($age - $moduleAge{$file});
+ my $ago = &Time2String(time() - $moduleAge{$file});
+
+ &VERB("Module: delta change: $dc",2);
+ &VERB("Module: ago: $ago",2);
+ }
&status("Module: Loading $mod...");
- &VERB("Module: delta change: $dc",2);
- &VERB("Module: ago: $ago",2);
delete $INC{$file};
eval "require \"$file\""; # require or use?