On 1/31/06, Randy W. Sims <ml-perl@thepierianspring.org> wrote: > > Thanks for working on this Yves... > > demerphq wrote: > > ------------------------------------------------------------------------ > > > > diff -wurd \.cpan\build\ExtUtils-MakeMaker-6.30/lib/ExtUtils/Install.pm ExtUtils-MakeMaker-6.30_patched/lib/ExtUtils/Install.pm > > --- \.cpan\build\ExtUtils-MakeMaker-6.30/lib/ExtUtils/Install.pm 2005-03-22 05:30:24.000000000 +0100 > > +++ ExtUtils-MakeMaker-6.30_patched/lib/ExtUtils/Install.pm 2006-01-30 23:58:27.013626600 +0100 > > @@ -91,6 +91,7 @@ > > use File::Path qw(mkpath); > > use File::Compare qw(compare); > > > > + my $win32=!$nonono && $^O eq 'MSWin32'; > > my(%from_to) = %$from_to; > > my(%pack, $dir, $warn_permissions); > > my($packlist) = ExtUtils::Packlist->new(); > > @@ -170,7 +171,28 @@ > > } > > > > if ($diff){ > > - if (-f $targetfile){ > > + if ($win32 && -f $targetfile && !unlink $targetfile) { > > + print "Can't remove existing '$targetfile': $!\n"; > > + require Win32API::File; > > Note that this module is not always available 0n Win32; it's not in > core. It does seem to be present ActiveState distros back to 5.005. Oh right, I forgot about Win32 second class citizenship in the core perl distro. I guess the patch needs tobe reworked not to choke if its missing. IMO we should be bundling some of the base modules from the libwin distro in core. Win32API::File being one of them, along with Win32API::Registry and Win32::TieRegistry, Win32::IPC, Win32::EventLog (the latter becuae we bundle *NIX specific counterparts so why should Win32 be left out?) But making EU::MM::Install work regardless of this happening is important too. So the attached patch doesn't invoke the special behaviour if Win32API::File is missing. > > + my $tmp= "AAA"; > > + ++$tmp while -e "$targetfile.$tmp"; > > + $tmp= "$targetfile.$tmp"; > > + if ( rename $targetfile, $tmp ) { > > + print "However it has been renamed as '$tmp' which ". > > + "will be removed at next reboot.\n"; > > + Win32API::File::MoveFileEx( $tmp, [], > > + Win32API::File::MOVEFILE_DELAY_UNTIL_REBOOT() ) > > + or die "MoveFileEx/Delete '$tmp' failed: $^E\n"; > > + } else { > > + print "Installation cannot be completed until you reboot.\n", > > + "Until then using '$tmp' as the install filename.\n"; > > + Win32API::File::MoveFileEx( $tmp, $targetfile, > > + Win32API::File::MOVEFILE_REPLACE_EXISTING() | > > + Win32API::File::MOVEFILE_DELAY_UNTIL_REBOOT() ) > > + or die "MoveFileEx/Replace '$tmp' failed: $^E\n"; > > + $targetfile= $tmp; > > + } > > + } elsif (-f $targetfile) { > > forceunlink($targetfile) unless $nonono; > > } else { > > mkpath($targetdir,0,0755) unless $nonono; > > > > > > -- perl -Mre=debug -e "/just|another|perl|hacker/"Thread Previous | Thread Next