2 # Files.pl: Open and close, read and probably write files.
4 # Version: v0.3 (20010120)
10 use vars qw(%lang %ircPort);
11 use vars qw(@ircServers);
12 use vars qw($bot_config_dir);
14 # File: Language support.
20 if (!open(FILE, $file)) {
21 &ERROR("Failed reading lang file ($file): $!");
25 undef %lang; # for rehash.
29 if ($_ eq "" || /^#/) {
41 &status("loadLang: bad line ('$_')");
45 $lang{$replyName}{$_} = 1;
51 &status("Loaded $file ($langCount items)");
54 # File: Irc Servers list.
56 my ($file) = $bot_config_dir."/blootbot.servers";
60 if (!open(FILE, $file)) {
61 &ERROR("Failed reading server list ($file): $!");
70 if (/^(\S+)(:(\d+))?$/) {
72 $ircPort{$1} = ($3 || 6667);
74 &status("loadIRCServers: invalid line => '$_'.");
80 &status("Loaded $file (". scalar(@ircServers) ." servers)");