Skip to content

Instantly share code, notes, and snippets.

@xaicron
Created July 17, 2011 15:34
Show Gist options
  • Save xaicron/1087692 to your computer and use it in GitHub Desktop.
Save xaicron/1087692 to your computer and use it in GitHub Desktop.
use strict;
use warnings;
use Win32::Unicode::Native;
use Win32API::File::Time qw(GetFileTime SetFileTime);
my $file = "\x{2603}"; # unicode file name (snowman)
touch $file or die $! unless file_type f => $file; # create
say $file;
say "-" x 34 . '+' . '-' x 25;
say "Win32::Unicode::Native::stat | ", join ", ", (stat $file)[8, 9];
say "Win32API::File::Time::GetFileTime | ", join ", ", GetFileTime($file); # not works
say "-" x 34 . '+' . '-' x 25;
say "Win32::Unicode::Native::utime | ", utime(time - 1000, time - 1000, $file);
say "Win32::Unicode::Native::stat | ", join ", ", (stat $file)[8, 9];
say "Win32API::File::Time::SetFileTime | ", SetFileTime($file, time, time, time); # not works
say "Win32::Unicode::Native::stat | ", join ", ", (stat $file)[8, 9];
say "-" x 34 . '+' . '-' x 25;
unlink $file or die $!; # cleanup
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment