diff options
Diffstat (limited to 'sboconfig')
-rwxr-xr-x | sboconfig | 10 |
1 files changed, 6 insertions, 4 deletions
@@ -79,7 +79,8 @@ show_usage() and exit 0 unless keys %options > 0; # setup what's being changed, sanity check. my %changes; -while (my ($key, $value) = each %valid_confs) { +for my $key (keys %valid_confs) { + my $value = $valid_confs{$key}; $changes{$value} = $options{$key} if exists $options{$key}; } @@ -141,11 +142,11 @@ sub config_write { warn $conffh; exit $exit; } - print {$conffh} $contents or return; + print {$conffh} $contents or return(); close $conffh, close $tempfh; } else { # no config file, easiest case of all. - my ($fh, $exit) = open_fh($conf_file, '>') or return; + my ($fh, $exit) = open_fh($conf_file, '>') or return(); if ($exit) { warn $fh; exit $exit; @@ -156,7 +157,8 @@ sub config_write { return 1; } -while (my ($key, $value) = each %changes) { +for my $key (keys %changes) { + my $value = $changes{$key}; say "Setting $key to $value..."; config_write($key, $value); } |