diff options
author | Michael G. Schwern <schwern@pobox.com> | 2002-04-05 22:22:03 -0500 |
---|---|---|
committer | Jarkko Hietaniemi <jhi@iki.fi> | 2002-04-06 16:58:02 +0000 |
commit | e0678a309fa2965f0728bdee01f05148de03bc0c (patch) | |
tree | ced0096c383a709fa9fcb1f19cecadc321b415cd /t | |
parent | 0dec8e5f6e4cdd984e494d64414f4a55f8bbee84 (diff) | |
download | perl-e0678a309fa2965f0728bdee01f05148de03bc0c.tar.gz |
MakeMaker core sync 5.54_01 -> 5.55_02
Message-ID: <20020406082203.GA28713@blackrider>
p4raw-id: //depot/perl@15764
Diffstat (limited to 't')
-rw-r--r-- | t/lib/MakeMaker/Test/Utils.pm | 42 |
1 files changed, 35 insertions, 7 deletions
diff --git a/t/lib/MakeMaker/Test/Utils.pm b/t/lib/MakeMaker/Test/Utils.pm index b1de088c83..e039a6f0e5 100644 --- a/t/lib/MakeMaker/Test/Utils.pm +++ b/t/lib/MakeMaker/Test/Utils.pm @@ -9,10 +9,10 @@ use vars qw($VERSION @ISA @EXPORT); require Exporter; @ISA = qw(Exporter); -$VERSION = 0.01; +$VERSION = 0.02; @EXPORT = qw(which_perl perl_lib makefile_name makefile_backup - make make_run make_macro + make make_run make_macro calibrate_mtime ); my $Is_VMS = $^O eq 'VMS'; @@ -36,6 +36,8 @@ MakeMaker::Test::Utils - Utility routines for testing MakeMaker my $make_run = make_run; make_macro($make, $targ, %macros); + my $mtime = calibrate_mtime; + =head1 DESCRIPTION A consolidation of little utility functions used through out the @@ -63,17 +65,24 @@ sub which_perl { # VMS should have 'perl' aliased properly return $perl if $Is_VMS; - $perl = File::Spec->rel2abs( $perl ); + $perl .= $Config{exe_ext} unless $perl =~ m/$Config{exe_ext}$/i; - unless( -x $perl ) { + my $perlpath = File::Spec->rel2abs( $perl ); + unless( -x $perlpath ) { # $^X was probably 'perl' + + # When building in the core, *don't* go off and find + # another perl + die "Can't find a perl to use (\$^X=$^X), (\$perlpath=$perlpath)" + if $ENV{PERL_CORE}; + foreach my $path (File::Spec->path) { - $perl = File::Spec->catfile($path, $^X); - last if -x $perl; + $perlpath = File::Spec->catfile($path, $perl); + last if -x $perlpath; } } - return $perl; + return $perlpath; } =item B<perl_lib> @@ -201,6 +210,25 @@ sub make_macro { return $is_mms ? "$make$macros $target" : "$make $target $macros"; } +=item B<calibrate_mtime> + + my $mtime = calibrate_mtime; + +When building on NFS, file modification times can often lose touch +with reality. This returns the mtime of a file which has just been +touched. + +=cut + +sub calibrate_mtime { + open(FILE, ">calibrate_mtime.tmp") || die $!; + print FILE "foo"; + close FILE; + my($mtime) = (stat('calibrate_mtime.tmp'))[9]; + unlink 'calibrate_mtime.tmp'; + return $mtime; +} + =back =head1 AUTHOR |