On Tue Apr 08 01:17:56 2008, adamkennedybackup@gmail.com wrote:
Show quoted text> Followup.
>
> I can validate that something as simple as
>
> if ( $^O eq 'MSWin32' ) {
> my $t = time;
> utime($t, $t, $dst);
> }
>
> ... at the end inside the main foreach in cp is enough to get it
> working for Strawberry Perl. I've patched the version I bundle with
> this change.
>
> Adam K
I'd be worried a bit about changing this behaviour, in that
ExtUtils::Command::cp:
http://search.cpan.org/src/RKOBES/ExtUtils-Command-1.14/lib/ExtUtils/Command.pm
relies on File::Copy::copy:
http://search.cpan.org/src/RGARCIA/perl-5.10.0/lib/File/Copy.pm
which doesn't preserve OS-specific attributes, apparently by choice.
File::Copy instead provides syscopy, the documentation for which says in
part
File::Copy also provides the C<syscopy> routine, which copies the
file specified in the first parameter to the file specified in the
second parameter, preserving OS-specific attributes and file
structure. For Unix systems, this is equivalent to the simple
C<copy> routine, which doesn't preserve OS-specific attributes. For
VMS systems, this calls the C<rmscopy> routine (see below). For OS/2
systems, this calls the C<syscopy> XSUB directly. For Win32 systems,
this calls C<Win32::CopyFile>.
For the particular problem of Win32, the documentation for
Win32::CopyFile says, in part:
Win32::CopyFile(FROM, TO, OVERWRITE)
[CORE] The Win32::CopyFile() function copies an existing file to a
new file. All file information like creation time and file
attributes will be copied to the new file. However it will not copy
the security information. If the destination file already exists it
will only be overwritten when the OVERWRITE parameter is true. But
even this will not overwrite a read-only file; you have to unlink()
it first yourself.
So, to be in synch with File::Copy, perhaps ExtUtils::Command could
provide a ExtUtils::Command::syscopy function, which would copy creation
time and file attributes to the new file. This though wouldn't solve the
problem of Makefiles using ExtUtils::Command::cp.