diff --git a/src/test/perl/TestLib.pm b/src/test/perl/TestLib.pm index da67f33c7e38929067350c7cf0da8fd8c5c1e43d..3d11cbb4535163ed22ba4ecd6c2efcbda41e8fba 100644 --- a/src/test/perl/TestLib.pm +++ b/src/test/perl/TestLib.pm @@ -158,9 +158,12 @@ sub slurp_dir sub slurp_file { + my ($filename) = @_; local $/; - local @ARGV = @_; - my $contents = <>; + open(my $in, '<', $filename) + or die "could not read \"$filename\": $!"; + my $contents = <$in>; + close $in; $contents =~ s/\r//g if $Config{osname} eq 'msys'; return $contents; } @@ -168,8 +171,8 @@ sub slurp_file sub append_to_file { my ($filename, $str) = @_; - - open my $fh, ">>", $filename or die "could not open \"$filename\": $!"; + open my $fh, ">>", $filename + or die "could not write \"$filename\": $!"; print $fh $str; close $fh; }