Skip to content

Instantly share code, notes, and snippets.

@afresh1
Created November 3, 2017 14:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save afresh1/814959ebfa171de0fda73f776b355c29 to your computer and use it in GitHub Desktop.
Save afresh1/814959ebfa171de0fda73f776b355c29 to your computer and use it in GitHub Desktop.
Forces File::Copy to use HiRes times in move.
#!/usr/bin/perl
use v5.20;;
use warnings;
BEGIN {
require Time::HiRes;
# Has to come before importing File::Copy
Time::HiRes->export( 'File::Copy', qw( stat utime ) );
}
use File::Copy;
open my $fh, '>out' or die $!;
say $fh "hai";
close $fh;
say [ File::Copy::stat('out') ]->[9];
File::Copy::move("out", "$ENV{HOME}/out");
say [ File::Copy::stat("$ENV{HOME}/out") ]->[9];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment