This is a live mirror of the Perl 5 development currently hosted at
https://github.com/perl/perl5
https://perl5.git.perl.org
/
perl5.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
4b711db
)
Re: [perl #36502] File::Copy::mv fails to replicate behavior of Unix mv
author
Michael G. Schwern
<schwern@pobox.com>
Mon, 11 Jul 2005 17:35:14 +0000
(10:35 -0700)
committer
Steve Hay
<SteveHay@planit.com>
Tue, 12 Jul 2005 11:03:55 +0000
(11:03 +0000)
Message-ID: <
20050712003514
.GA20132@windhund.schwern.org>
p4raw-id: //depot/perl@25120
lib/File/Copy.pm
patch
|
blob
|
blame
|
history
diff --git
a/lib/File/Copy.pm
b/lib/File/Copy.pm
index
828473e
..
6316b97
100644
(file)
--- a/
lib/File/Copy.pm
+++ b/
lib/File/Copy.pm
@@
-205,7
+205,17
@@
sub move {
$tosz2 == $fromsz; # it's all there
($tosz1,$tomt1) = (stat($to))[7,9]; # just in case rename did something
- return 1 if copy($from,$to) && unlink($from);
+
+ {
+ local $@;
+ eval {
+ copy($from,$to) or die;
+ my($atime, $mtime) = (stat($from))[8,9];
+ utime($atime, $mtime, $to);
+ unlink($from) or die;
+ };
+ return 1 unless $@;
+ }
($sts,$ossts) = ($! + 0, $^E + 0);
($tosz2,$tomt2) = ((stat($to))[7,9],0,0) if defined $tomt1;