develooper Front page | perl.perl5.porters | Postings from April 2003

[PATCH] ExtUtils::Install and the don't-really-do-it switch

From:
Slaven Rezic
Date:
April 23, 2003 16:07
Subject:
[PATCH] ExtUtils::Install and the don't-really-do-it switch
Message ID:
200304232242.h3NMgBqD028515@vran.herceg.de
The patch below causes the don't-really-do-it switch of
ExtUtils::Install::install to do really nothing.

Regards,
	Slaven

#### Patch data follows ####
diff -up 'bleedperl/lib/ExtUtils/Install.pm' 'bleedperl2/lib/ExtUtils/Install.pm'
Index: ./lib/ExtUtils/Install.pm
--- ./lib/ExtUtils/Install.pm	Mon Apr  7 21:35:35 2003
+++ ./lib/ExtUtils/Install.pm	Thu Apr 24 00:32:51 2003
@@ -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 -up 'bleedperl/lib/ExtUtils/t/Install.t' 'bleedperl2/lib/ExtUtils/t/Install.t'
Index: ./lib/ExtUtils/t/Install.t
--- ./lib/ExtUtils/t/Install.t	Sun Apr 13 14:56:00 2003
+++ ./lib/ExtUtils/t/Install.t	Thu Apr 24 00:35:30 2003
@@ -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 f
 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',
#### End of Patch data ####

-- 
Slaven Rezic - slaven@rezic.de
    babybike - routeplanner for cyclists in Berlin
	       handheld (e.g. Compaq iPAQ with Linux) version of bbbike
    http://bbbike.sourceforge.net



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About