From 12ab108ac9be2fd27700ca2f92b2a73f04ac4803 Mon Sep 17 00:00:00 2001 From: Andreas Guldstrand Date: Sat, 14 Nov 2015 04:04:34 +0100 Subject: Additional Perl::Critic::Freenode fixes, and one missed prototype --- sboconfig | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'sboconfig') diff --git a/sboconfig b/sboconfig index 7c854b8..0bf7de4 100755 --- a/sboconfig +++ b/sboconfig @@ -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); } -- cgit v1.2.3