From 310d015584c7347660e80d991a5d32c55cc06c94 Mon Sep 17 00:00:00 2001 From: Andrew Fresh Date: Sun, 5 Nov 2017 12:31:12 -0800 Subject: Support Time::HiRes::utime in File::Copy If Time::HiRes exists and has utime support for setting hires utime, use that so cross-device moves can keep time accurately. Used by autoconf. --- lib/File/Copy.pm | 2 ++ lib/File/Copy.t | 7 ++++++- 2 files changed, 8 insertions(+), 1 deletion(-) (limited to 'lib/File') diff --git a/lib/File/Copy.pm b/lib/File/Copy.pm index 47e6429771..7656cb7204 100644 --- a/lib/File/Copy.pm +++ b/lib/File/Copy.pm @@ -16,6 +16,8 @@ use Config; # And then we need these games to avoid loading overload, as that will # confuse miniperl during the bootstrap of perl. my $Scalar_Util_loaded = eval q{ require Scalar::Util; require overload; 1 }; +# We want HiRes stat and utime if available +BEGIN { eval q{ use Time::HiRes qw( stat utime ) } }; our(@ISA, @EXPORT, @EXPORT_OK, $VERSION, $Too_Big, $Syscopy_is_copy); sub copy; sub syscopy; diff --git a/lib/File/Copy.t b/lib/File/Copy.t index 25f340d1c0..57d9478a68 100644 --- a/lib/File/Copy.t +++ b/lib/File/Copy.t @@ -24,6 +24,11 @@ BEGIN { *CORE::GLOBAL::rename = sub { CORE::rename($_[0], $_[1]) }; } use File::Copy qw(copy move cp); use Config; +# If we have Time::HiRes, File::Copy loaded it for us. +BEGIN { + eval { Time::HiRes->import(qw( stat utime )) }; + note "Testing Time::HiRes::utime support" unless $@; +} foreach my $code ("copy()", "copy('arg')", "copy('arg', 'arg', 'arg', 'arg')", "move()", "move('arg')", "move('arg', 'arg', 'arg')" @@ -102,7 +107,7 @@ for my $cross_partition_test (0..1) { ok -e "copy-$$", ' target still there'; # Doesn't really matter what time it is as long as its not now. - my $time = 1000000000; + my $time = 1000000000.12345; utime( $time, $time, "copy-$$" ); # Recheck the mtime rather than rely on utime in case we're on a -- cgit v1.2.1 From 12c7b34289b4fb3f2bd8d44822054debf0b038f1 Mon Sep 17 00:00:00 2001 From: James E Keenan Date: Mon, 6 Nov 2017 09:45:43 -0500 Subject: Increment $File::Copy::VERSION --- lib/File/Copy.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/File') diff --git a/lib/File/Copy.pm b/lib/File/Copy.pm index 7656cb7204..b796451e37 100644 --- a/lib/File/Copy.pm +++ b/lib/File/Copy.pm @@ -24,7 +24,7 @@ sub syscopy; sub cp; sub mv; -$VERSION = '2.32'; +$VERSION = '2.33'; require Exporter; @ISA = qw(Exporter); -- cgit v1.2.1