diff options
author | Andrew Dunstan | 2020-04-13 16:06:11 +0000 |
---|---|---|
committer | Andrew Dunstan | 2020-04-13 16:06:11 +0000 |
commit | 8f00d84afc0dad577b65df5a313e5306cee3d11f (patch) | |
tree | 25c63a3060ecf5163c849d0f5d0436668d37aaaf /src/tools/msvc/Project.pm | |
parent | 7be5d8df1f74b78620167d3abf32ee607e728919 (diff) |
Use perl's $/ more idiomatically
This replaces a few occurrences of ugly code with a more clean and
idiomatic usage. The problem was highlighted by perlcritic, but we're
not enforcing the policy that led to the discovery.
Discussion: https://postgr.es/m/20200412074245.GB623763@rfd.leadboat.com
Diffstat (limited to 'src/tools/msvc/Project.pm')
-rw-r--r-- | src/tools/msvc/Project.pm | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/src/tools/msvc/Project.pm b/src/tools/msvc/Project.pm index d90a996d467..20f79b382b1 100644 --- a/src/tools/msvc/Project.pm +++ b/src/tools/msvc/Project.pm @@ -420,13 +420,10 @@ sub read_file { my $filename = shift; my $F; - my $t = $/; - - undef $/; + local $/ = undef; open($F, '<', $filename) || croak "Could not open file $filename\n"; my $txt = <$F>; close($F); - $/ = $t; return $txt; } @@ -435,15 +432,12 @@ sub read_makefile { my $reldir = shift; my $F; - my $t = $/; - - undef $/; + local $/ = undef; open($F, '<', "$reldir/GNUmakefile") || open($F, '<', "$reldir/Makefile") || confess "Could not open $reldir/Makefile\n"; my $txt = <$F>; close($F); - $/ = $t; return $txt; } |