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 . "/infobot.servers";
60 if ( !open( FILE, $file ) ) {
61 &ERROR("Failed reading server list ($file): $!");
70 if (/^\s*(\S+?)(:(\d+))?\s*$/) {
71 push( @ircServers, $1 );
72 $ircPort{$1} = ( $3 || 6667 );
75 &status("loadIRCServers: invalid line => '$_'.");
81 &status( "Loaded $file (" . scalar(@ircServers) . " servers)" );
86 # vim:ts=4:sw=4:expandtab:tw=80