diff options
author | Andreas Guldstrand <andreas.guldstrand@gmail.com> | 2015-11-14 04:04:34 +0100 |
---|---|---|
committer | Andreas Guldstrand <andreas.guldstrand@gmail.com> | 2015-11-14 04:04:34 +0100 |
commit | 12ab108ac9be2fd27700ca2f92b2a73f04ac4803 (patch) | |
tree | d039751c0d102b467dd5c59a5047867a9e28c2e6 /sboconfig | |
parent | eaa18fd91c51c136ff6ec607d46d32b87a2ea34f (diff) | |
download | sbotools2-12ab108ac9be2fd27700ca2f92b2a73f04ac4803.tar.xz |
Additional Perl::Critic::Freenode fixes, and one missed prototype
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); } |