in reply to Re^2: Reading and Writing Perl Config Files
in thread Reading and Writing Perl Config Files
# Defines logging groups in terms of room: if device's room maatches r +oom name or if device name is listed separately in hash, then is logg +ed into same log: %Log_rooms = ( "gallery" => { 'BM_shutts_south_00' => 1, 'BM_shutt_no +rth_00' => 1 }, "kitchen" => { }, "office" => { }, "living" => { }, "utility" => { }, "kurilnica" => {}, "lobby" => { }, "toilet" => { } );
use Data::Dumper; use Safe; my %Log_rooms; my $config_file ="./Log.conf"; if (-e $config_file) { print "File Exists!"; # my $comp = new Safe; # my $return =$comp->reval($config_file); my $return = do $config_file ; warn "couldn't parse $config_file: $@" if $@; warn "couldn't do $config_file: $!" unless defined $return; warn "couldn't run $config_file" unless $return; } else { %Log_rooms = ( "default" => { 'BM_shutts_south_00' => 1, 'BM_shutt_no +rth_00' => 1 } ); }; print "############################################################### +#################\n"; print Data::Dumper::Dumper(%Log_rooms);
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^4: Reading and Writing Perl Config Files
by Anonymous Monk on Apr 20, 2009 at 20:52 UTC | |
Re^4: Reading and Writing Perl Config Files
by Anonymous Monk on Mar 06, 2011 at 09:31 UTC |