aboutsummaryrefslogtreecommitdiff
path: root/sboconfig
diff options
context:
space:
mode:
authorJacob Pipkin <j@dawnrazor.net>2012-06-05 12:44:48 -0500
committerJacob Pipkin <j@dawnrazor.net>2012-06-05 12:44:48 -0500
commita158c22df50796bbf02d876d6197635a1899aba6 (patch)
tree22714fae8f37adafe1be78f8488b523edbbdcb1e /sboconfig
parentae9bb71900fe625562c124debcf4f7b316a1bb3a (diff)
downloadsbotools2-a158c22df50796bbf02d876d6197635a1899aba6.tar.xz
factored out "open my $fh, $op, $file" and made it robust in one fell swoop
Diffstat (limited to 'sboconfig')
-rwxr-xr-xsboconfig12
1 files changed, 6 insertions, 6 deletions
diff --git a/sboconfig b/sboconfig
index 63f1d51..231d6ee 100755
--- a/sboconfig
+++ b/sboconfig
@@ -104,16 +104,16 @@ sub config_write {
untie @temp;
# otherwise, append our new $key=$value pair
if ($has eq 'FALSE') {
- open (my $writer, '>>', $filename);
- print {$writer} "$key=$val\n";
- close $writer;
+ my $fh = open_fh ($filename, '>>');
+ print {$fh} "$key=$val\n";
+ close $fh;
}
move ($filename, $conf_file);
} else {
# no config file, easiest case of all.
- open my $writer, '>', $conf_file;
- print {$writer} "$key=$val\n";
- close $writer;
+ my $fh = open_fh ($conf_file, '>');
+ print {$fh} "$key=$val\n";
+ close $fh;
}
}