From: Slaven Rezic Date: Thu, 24 Apr 2003 00:42:11 +0000 (+0200) Subject: ExtUtils::Install and the don't-really-do-it switch X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=ab00ffcda35bbed540111e6fb03a2770e637aa3f;p=p5sagit%2Fp5-mst-13.2.git ExtUtils::Install and the don't-really-do-it switch Message-Id: <200304232242.h3NMgBqD028515@vran.herceg.de> p4raw-id: //depot/perl@19421 --- diff --git a/lib/ExtUtils/Install.pm b/lib/ExtUtils/Install.pm index 5763f1b..68fe343 100644 --- a/lib/ExtUtils/Install.pm +++ b/lib/ExtUtils/Install.pm @@ -108,13 +108,20 @@ sub install { for (readdir DIR) { next if $_ eq $Curdir || $_ eq $Updir || $_ eq ".exists"; my $targetdir = install_rooted_dir($from_to{$source_dir_or_file}); - if (-w $targetdir || - mkpath($targetdir)) { + if ($nonono) { + if (!-w $targetdir) { + print "mkpath($targetdir)\n" if $verbose>1; + } last; } else { - warn "Warning: You do not have permissions to " . - "install into $from_to{$source_dir_or_file}" - unless $warn_permissions++; + if (-w $targetdir || + mkpath($targetdir)) { + last; + } else { + warn "Warning: You do not have permissions to " . + "install into $from_to{$source_dir_or_file}" + unless $warn_permissions++; + } } } closedir DIR; @@ -203,9 +210,9 @@ sub install { } if ($pack{'write'}) { $dir = install_rooted_dir(dirname($pack{'write'})); - mkpath($dir,0,0755); + mkpath($dir,0,0755) unless $nonono; print "Writing $pack{'write'}\n"; - $packlist->write(install_rooted_file($pack{'write'})); + $packlist->write(install_rooted_file($pack{'write'})) unless $nonono; } } diff --git a/lib/ExtUtils/t/Install.t b/lib/ExtUtils/t/Install.t index c9463e7..c628333 100644 --- a/lib/ExtUtils/t/Install.t +++ b/lib/ExtUtils/t/Install.t @@ -17,7 +17,7 @@ use TieOut; use File::Path; use File::Spec; -use Test::More tests => 18; +use Test::More tests => 21; BEGIN { use_ok('ExtUtils::Install') } @@ -46,6 +46,14 @@ ok( -r 'blib/lib/Big/Dummy.pm', ' .pm file still there' ); ok( -r 'blib/lib/auto', ' autosplit still there' ); is( $stdout->read, "Skip blib/lib/Big/Dummy.pm (unchanged)\n" ); +install( { 'blib/lib' => 'install-test/lib/perl', + read => 'install-test/packlist', + write => 'install-test/packlist' + }, + 0, 1); +ok( ! -d 'install-test/lib/perl', 'install made dir - dry run' ); +ok( ! -r 'install-test/lib/perl/Big/Dummy.pm', ' .pm file installed - dry run' ); +ok( ! -r 'install-test/packlist', ' packlist exists - dry run' ); install( { 'blib/lib' => 'install-test/lib/perl', read => 'install-test/packlist',