diff options
author | Nicholas Clark <nick@ccl4.org> | 2008-10-17 08:46:28 +0000 |
---|---|---|
committer | Nicholas Clark <nick@ccl4.org> | 2008-10-17 08:46:28 +0000 |
commit | a65cb92d1f93e8343c90e37bd9d70f91efe34546 (patch) | |
tree | 9ec09d8b17f72e89bef272251b86f3a15897cd2c /t | |
parent | 95e06916561ca1cbaa0ca21057644bd664ebf2dc (diff) | |
download | perl-a65cb92d1f93e8343c90e37bd9d70f91efe34546.tar.gz |
Upgrade to ExtUtils-MakeMaker-6.47_02
p4raw-id: //depot/perl@34498
Diffstat (limited to 't')
-rw-r--r-- | t/lib/MakeMaker/Test/Utils.pm | 42 |
1 files changed, 20 insertions, 22 deletions
diff --git a/t/lib/MakeMaker/Test/Utils.pm b/t/lib/MakeMaker/Test/Utils.pm index 8c9fc7be26..9cbd015007 100644 --- a/t/lib/MakeMaker/Test/Utils.pm +++ b/t/lib/MakeMaker/Test/Utils.pm @@ -4,21 +4,20 @@ use File::Spec; use strict; use Config; -use vars qw($VERSION @ISA @EXPORT); - require Exporter; -@ISA = qw(Exporter); +our @ISA = qw(Exporter); -$VERSION = 0.04; +our $VERSION = 0.04; -@EXPORT = qw(which_perl perl_lib makefile_name makefile_backup - make make_run run make_macro calibrate_mtime - setup_mm_test_root - have_compiler slurp - ); +our $Is_VMS = $^O eq 'VMS'; +our $Is_MacOS = $^O eq 'MacOS'; -my $Is_VMS = $^O eq 'VMS'; -my $Is_MacOS = $^O eq 'MacOS'; +our @EXPORT = qw(which_perl perl_lib makefile_name makefile_backup + make make_run run make_macro calibrate_mtime + setup_mm_test_root + have_compiler slurp + $Is_VMS $Is_MacOS + ); =head1 NAME @@ -325,23 +324,22 @@ sub have_compiler { =item slurp - $text = slurp($filename); + $contents = slurp($filename); + +Returns the $contents of $filename. -Returns the contents of a file if it can be read, otherwise undef. -Contents of excessively large files are truncated to a couple of -kilobytes, though. +Will die if $filename cannot be opened. =cut sub slurp { my $filename = shift; - my $text = undef; - local *FH; - local $/ = \8192; - if (open FH, $filename) { - $text = <FH>; - close FH; - } + + local $/ = undef; + open my $fh, $filename or die "Can't open $filename for reading: $!"; + my $text = <$fh>; + close $fh; + return $text; } |