use readfile() instead of reinventing it
authorSimon McVittie <smcv@debian.org>
Mon, 1 Sep 2014 07:40:54 +0000 (08:40 +0100)
committerSimon McVittie <smcv@debian.org>
Mon, 1 Sep 2014 07:40:54 +0000 (08:40 +0100)
This avoids potential action-at-a-distance from locally redefining $/
but never reaching the end of the redefinition's scope.

t/img.t

diff --git a/t/img.t b/t/img.t
index 088a98328861fcb77fd15431cec1b4cc340c20e3..9a48cb1c55ac94dfb8023f9730801c71d217e367 100755 (executable)
--- a/t/img.t
+++ b/t/img.t
@@ -52,10 +52,7 @@ sub size($) {
 }
 
 my $outpath = "t/tmp/out/imgconversions";
-open (my $outhtmlfd, "<", "$outpath.html");
-local $/=undef;
-my $outhtml = <$outhtmlfd>;
-close $outhtmlfd;
+my $outhtml = readfile("$outpath.html");
 
 is(size("$outpath/10x-redsquare.png"), "10x10");
 ok(! -e "$outpath/30x-redsquare.png");