From: Andres S. <di...@us...> - 2006-06-03 13:48:58
|
Update of /cvsroot/tuxaator/tuxaator In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv23737 Modified Files: tuxaator Log Message: neated up the configuration reading loop Index: tuxaator =================================================================== RCS file: /cvsroot/tuxaator/tuxaator/tuxaator,v retrieving revision 1.91 retrieving revision 1.92 diff -C2 -d -r1.91 -r1.92 *** tuxaator 11 Feb 2005 20:33:34 -0000 1.91 --- tuxaator 3 Jun 2006 13:48:45 -0000 1.92 *************** *** 182,189 **** or die "Can't connect to IRC server.\n"; $Output = new Plugins::Output($conn); ! if ($config{'logfile'}) ! { ! $Log = new Plugins::Log($basedir . "/log"); ! }; #$Plugin = new Tuxaator::Plugin($conn,$config); --- 182,186 ---- or die "Can't connect to IRC server.\n"; $Output = new Plugins::Output($conn); ! $Log = new Plugins::Log($basedir . "/log") if $config{'logfile'}; #$Plugin = new Tuxaator::Plugin($conn,$config); *************** *** 220,246 **** sub read_config { ! open CFG,"<config/config.tux" or die sprintf($messages{'file_open_failed'},"config/config.tux"); ! while (<CFG>) ! { ! unless (/^#/) ! { ! my ($key,$value) = &parse_line($_); ! if ($key && $value) ! { ! # oh god, this is so depressing. ! # assigning values to global hash ! $config{$key} = $value; ! # print "CFG: got $key with value $value\n" if $DEBUG; ! }; ! }; ! }; ! close CFG; ! } ! ! ! sub parse_line { ! my $line = shift; ! my ($part1,$part2) = $line =~ /^\s*(.+?)\s*=\s*(.+?)$/; ! return ($part1,$part2); } --- 217,230 ---- sub read_config { ! open CFG, "<config/config.tux" ! or die sprintf($messages{'file_open_failed'}, "config/config.tux"); ! while (<CFG>) { ! unless (/^#/) { ! if (m/^\s*(.+?)\s*=\s*(.+?)$/) { ! $config{$1} = $2; ! } ! } ! } ! close CFG; } |