From 92b6bb5f81aedd038238256d9d1404ca583e6d7a Mon Sep 17 00:00:00 2001 From: Thierry Vignaud Date: Wed, 17 Oct 2012 16:30:40 +0000 Subject: (get,commit) do not reinvent cat_() --- common/Varspaceval.pm | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/common/Varspaceval.pm b/common/Varspaceval.pm index 0da4393c..feef189d 100644 --- a/common/Varspaceval.pm +++ b/common/Varspaceval.pm @@ -19,10 +19,8 @@ use MDK::Common; sub get { my ($_self, $file) = @_; my %l; - open my $F, $file or return; - local $_; - while (<$F>) { + foreach (cat_($file)) { my ($v, $val, $val2) = /^\s* # leading space @@ -46,10 +44,9 @@ sub commit { my ($_self, $file, $hash) = @_; my $output = ""; - if (open(my $F, $file)) { - local $_; + if (-r $file) { - while (<$F>) { + foreach (cat_($file)) { my ($pre, $key, $eq, $val, $rest) = /(^\s*)(\w+)(\s*"*'*)([^'"\s]*)(.*)/x; if (!defined $key) { -- cgit v1.2.1