Blob Blame History Raw
Module-Build-0.35

diff -urN perl-5.10.1.orig/MANIFEST perl-5.10.1/MANIFEST
--- perl-5.10.1.orig/MANIFEST	2009-12-01 17:01:57.000000000 +0100
+++ perl-5.10.1/MANIFEST	2009-12-01 11:52:20.000000000 +0100
@@ -2625,6 +2625,7 @@
 lib/Module/Build/t/ext.t	Module::Build
 lib/Module/Build/t/files.t	Module::Build
 lib/Module/Build/t/help.t	Module::Build
+lib/Module/Build/t/install_extra_target.t	Module::Build
 lib/Module/Build/t/install.t	Module::Build
 lib/Module/Build/t/lib/DistGen.pm	Module::Build
 lib/Module/Build/t/lib/MBTest.pm	Module::Build
diff -urN perl-5.10.1.orig/lib/Module/Build/API.pod perl-5.10.1/lib/Module/Build/API.pod
--- perl-5.10.1.orig/lib/Module/Build/API.pod	2009-12-01 17:01:57.000000000 +0100
+++ perl-5.10.1/lib/Module/Build/API.pod	2009-12-01 11:51:27.000000000 +0100
@@ -78,7 +78,9 @@
 
 This parameter determines whether Module::Build will add itself
 automatically to configure_requires (and build_requires) if Module::Build
-is not already there.  The default value is true.
+is not already there.  The required version will be the last 'major' release,
+as defined by the decimal version truncated to two decimal places (e.g. 0.34,
+instead of 0.3402).  The default value is true.
 
 =item auto_features
 
@@ -387,23 +389,24 @@
     (
      module_name => 'Foo::Bar',
      get_options => {
-                     loud =>     { store => \$loud },
-                     dbd  =>     { type  => '=s'   },
-                     quantity => { type  => '+'    },
+                     Loud =>     { store => \$loud },
+                     Dbd  =>     { type  => '=s'   },
+                     Quantity => { type  => '+'    },
                     }
     );
 
   print STDERR "HEY, ARE YOU LISTENING??\n" if $loud;
-  print "We'll use the ", $build->args('dbd'), " DBI driver\n";
+  print "We'll use the ", $build->args('Dbd'), " DBI driver\n";
   print "Are you sure you want that many?\n"
-    if $build->args('quantity') > 2;
+    if $build->args('Quantity') > 2;
 
 The arguments for such a specification can be called like so:
 
-  perl Build.PL --loud --dbd=DBD::pg --quantity --quantity --quantity
+  perl Build.PL --Loud --Dbd=DBD::pg --Quantity --Quantity --Quantity
 
 B<WARNING:> Any option specifications that conflict with Module::Build's own
-options (defined by its properties) will throw an exception.
+options (defined by its properties) will throw an exception.  Use capitalized
+option names to avoid unintended conflicts with future Module::Build options.
 
 Consult the Getopt::Long documentation for details on its usage.
 
@@ -1809,8 +1812,6 @@
 
 =item install_base()
 
-=item install_sets()
-
 =item installdirs()
 
 =item libdoc_dirs()
@@ -1831,8 +1832,6 @@
 
 =item orig_dir()
 
-=item original_prefix()
-
 =item perl()
 
 =item pm_files()
diff -urN perl-5.10.1.orig/lib/Module/Build/Base.pm perl-5.10.1/lib/Module/Build/Base.pm
--- perl-5.10.1.orig/lib/Module/Build/Base.pm	2009-12-01 17:01:57.000000000 +0100
+++ perl-5.10.1/lib/Module/Build/Base.pm	2009-12-01 11:51:27.000000000 +0100
@@ -4,7 +4,7 @@
 
 use strict;
 use vars qw($VERSION);
-$VERSION = '0.340201';
+$VERSION = '0.35';
 $VERSION = eval $VERSION;
 BEGIN { require 5.00503 }
 
@@ -42,7 +42,6 @@
   $self->dist_name;
   $self->dist_version;
 
-  $self->_set_install_paths;
   $self->_find_nested_builds;
 
   return $self;
@@ -86,8 +85,6 @@
   
   $self->{invoked_action} = $self->{action} ||= 'build';
 
-  $self->_set_install_paths;
-  
   return $self;
 }
 
@@ -208,10 +205,12 @@
 }
 
 
-sub _set_install_paths {
+# install paths must be generated when requested to be sure all changes
+# to config (from various sources) are included
+sub _default_install_paths {
   my $self = shift;
   my $c = $self->{config};
-  my $p = $self->{properties};
+  my $p = {};
 
   my @libstyle = $c->get('installstyle') ?
       File::Spec->splitdir($c->get('installstyle')) : qw(lib perl5);
@@ -318,7 +317,7 @@
 	      libhtml    => ['html'],
 	     },
     };
-
+    return $p
 }
 
 sub _find_nested_builds {
@@ -1839,6 +1838,8 @@
 sub _merge_arglist {
   my( $self, $opts1, $opts2 ) = @_;
 
+  $opts1 ||= {};
+  $opts2 ||= {};
   my %new_opts = %$opts1;
   while (my ($key, $val) = each %$opts2) {
     if ( exists( $opts1->{$key} ) ) {
@@ -2738,7 +2739,8 @@
     my $outfile = File::Spec->catfile($mandir, $manpage);
     next if $self->up_to_date( $file, $outfile );
     $self->log_info("Manifying $file -> $outfile\n");
-    $parser->parse_from_file( $file, $outfile );
+    eval { $parser->parse_from_file( $file, $outfile ); 1 }
+      or $self->log_warn("Error creating '$outfile': $@\n"); 
     $files->{$file} = $outfile;
   }
 }
@@ -2762,7 +2764,8 @@
     my $outfile = File::Spec->catfile( $mandir, $manpage);
     next if $self->up_to_date( $file, $outfile );
     $self->log_info("Manifying $file -> $outfile\n");
-    $parser->parse_from_file( $file, $outfile );
+    eval { $parser->parse_from_file( $file, $outfile ); 1 }
+      or $self->log_warn("Error creating '$outfile': $@\n"); 
     $files->{$file} = $outfile;
   }
 }
@@ -3754,7 +3757,8 @@
     && $self->auto_configure_requires
     && ! exists $prereq_types{'configure_requires'}{'Module::Build'}
   ) {
-    $prereq_types{configure_requires}{'Module::Build'} = $VERSION;
+    (my $ver = $VERSION) =~ s/^(\d+\.\d\d).*$/$1/; # last major release only
+    $prereq_types{configure_requires}{'Module::Build'} = $ver;
   }
 
   for my $t ( keys %prereq_types ) {
@@ -3976,7 +3980,10 @@
     $self->do_system($self->split_like_shell($self->{args}{tar}), $tar_flags, "$file.tar", $dir);
     $self->do_system($self->split_like_shell($self->{args}{gzip}), "$file.tar") if $self->{args}{gzip};
   } else {
-    require Archive::Tar;
+    eval { require Archive::Tar && Archive::Tar->VERSION(1.08); 1 }
+      or die "You must install Archive::Tar to make a distribution tarball\n".
+             "or specify a binary tar program with the '--tar' option.\n".
+             "See the documentation for the 'dist' action.\n";
 
     # Archive::Tar versions >= 1.09 use the following to enable a compatibility
     # hack so that the resulting archive is compatible with older clients.
@@ -4018,73 +4025,118 @@
   return $map->{$type} = $value;
 }
 
+sub install_sets {
+  # Usage: install_sets('site'), install_sets('site', 'lib'),
+  #   or install_sets('site', 'lib' => $value);
+  my ($self, $dirs, $key, $value) = @_;
+  $dirs = $self->installdirs unless defined $dirs;
+  # update property before merging with defaults
+  if ( @_ == 4 && defined $dirs && defined $key) {
+    # $value can be undef; will mask default
+    $self->{properties}{install_sets}{$dirs}{$key} = $value;
+  }
+  my $map = { $self->_merge_arglist(
+    $self->{properties}{install_sets},
+    $self->_default_install_paths->{install_sets}
+  )};
+  if ( defined $dirs && defined $key ) {
+    return $map->{$dirs}{$key};
+  }
+  elsif ( defined $dirs ) {
+    return $map->{$dirs};
+  }
+  else {
+    croak "Can't determine installdirs for install_sets()";
+  }
+}
+
+sub original_prefix {
+  # Usage: original_prefix(), original_prefix('lib'),
+  #   or original_prefix('lib' => $value);
+  my ($self, $key, $value) = @_;
+  # update property before merging with defaults
+  if ( @_ == 3 && defined $key) { 
+    # $value can be undef; will mask default
+    $self->{properties}{original_prefix}{$key} = $value;
+  }
+  my $map = { $self->_merge_arglist(
+    $self->{properties}{original_prefix},
+    $self->_default_install_paths->{original_prefix}
+  )};
+  return $map unless defined $key;
+  return $map->{$key}
+}
+
 sub install_base_relpaths {
   # Usage: install_base_relpaths(), install_base_relpaths('lib'),
   #   or install_base_relpaths('lib' => $value);
   my $self = shift;
-  my $map = $self->{properties}{install_base_relpaths};
+  if ( @_ > 1 ) { # change values before merge
+    $self->_set_relpaths($self->{properties}{install_base_relpaths}, @_);
+  }
+  my $map = { $self->_merge_arglist(
+    $self->{properties}{install_base_relpaths},
+    $self->_default_install_paths->{install_base_relpaths}
+  )};
   return $map unless @_;
-  return $self->_relpaths($map, @_);
+  my $relpath = $map->{$_[0]};
+  return defined $relpath ? File::Spec->catdir( @$relpath ) : undef;
 }
 
-
-# Translated from ExtUtils::MM_Any::init_INSTALL_from_PREFIX
-sub prefix_relative {
-  my ($self, $type) = @_;
-  my $installdirs = $self->installdirs;
-
-  my $relpath = $self->install_sets($installdirs)->{$type};
-
-  return $self->_prefixify($relpath,
-			   $self->original_prefix($installdirs),
-			   $type,
-			  );
+# Defaults to use in case the config install paths cannot be prefixified.
+sub prefix_relpaths {
+  # Usage: prefix_relpaths('site'), prefix_relpaths('site', 'lib'),
+  #   or prefix_relpaths('site', 'lib' => $value);
+  my $self = shift;
+  my $installdirs = shift || $self->installdirs
+    or croak "Can't determine installdirs for prefix_relpaths()";
+  if ( @_ > 1 ) { # change values before merge
+    $self->{properties}{prefix_relpaths}{$installdirs} ||= {};
+    $self->_set_relpaths($self->{properties}{prefix_relpaths}{$installdirs}, @_);
+  }
+  my $map = {$self->_merge_arglist(
+    $self->{properties}{prefix_relpaths}{$installdirs},
+    $self->_default_install_paths->{prefix_relpaths}{$installdirs}
+  )};
+  return $map unless @_;
+  my $relpath = $map->{$_[0]};
+  return defined $relpath ? File::Spec->catdir( @$relpath ) : undef;
 }
 
-sub _relpaths {
+sub _set_relpaths {
   my $self = shift;
-  my( $map, $type, $value ) = ( @_, '<empty>' );
+  my( $map, $type, $value ) = @_;
 
   Carp::croak( 'Type argument missing' )
     unless defined( $type );
 
-  my @value = ();
-
-  # delete existing value if $value is literal undef()
-  unless ( defined( $value ) ) {
-    delete( $map->{$type} );
-    return undef;
-  }
-
-  # return existing value if no new $value is given
-  elsif ( $value eq '<empty>' ) {
-    return undef unless exists $map->{$type};
-    @value = @{ $map->{$type} };
+  # set undef if $value is literal undef()
+  if ( ! defined( $value ) ) {
+    $map->{$type} = undef;
+    return;
   }
-
   # set value if $value is a valid relative path
   else {
     Carp::croak( "Value must be a relative path" )
       if File::Spec::Unix->file_name_is_absolute($value);
 
-    @value = split( /\//, $value );
+    my @value = split( /\//, $value );
     $map->{$type} = \@value;
   }
-
-  return File::Spec->catdir( @value );
 }
 
-# Defaults to use in case the config install paths cannot be prefixified.
-sub prefix_relpaths {
-  # Usage: prefix_relpaths('site'), prefix_relpaths('site', 'lib'),
-  #   or prefix_relpaths('site', 'lib' => $value);
-  my $self = shift;
-  my $installdirs = shift || $self->installdirs;
-  my $map = $self->{properties}{prefix_relpaths}{$installdirs};
-  return $map unless @_;
-  return $self->_relpaths($map, @_);
-}
+# Translated from ExtUtils::MM_Any::init_INSTALL_from_PREFIX
+sub prefix_relative {
+  my ($self, $type) = @_;
+  my $installdirs = $self->installdirs;
 
+  my $relpath = $self->install_sets($installdirs)->{$type};
+
+  return $self->_prefixify($relpath,
+			   $self->original_prefix($installdirs),
+			   $type,
+			  );
+}
 
 # Translated from ExtUtils::MM_Unix::prefixify()
 sub _prefixify {
diff -urN perl-5.10.1.orig/lib/Module/Build/Changes perl-5.10.1/lib/Module/Build/Changes
--- perl-5.10.1.orig/lib/Module/Build/Changes	2009-12-01 17:01:57.000000000 +0100
+++ perl-5.10.1/lib/Module/Build/Changes	2009-12-01 11:50:30.000000000 +0100
@@ -1,5 +1,48 @@
 Revision history for Perl extension Module::Build.
 
+0.35 - Thu Aug 27 09:12:02 EDT 2009
+
+ Bug fixes:
+ - Fix t/destinations.t segfault on 5.6.2
+
+0.34_06 - Sat Aug 22 21:58:26 EDT 2009
+
+ Bug fixes:
+ - Multiple test fixes for OS2 [Ilya Zakharevich]
+ - Generated.ppd files use :utf8 if possible (RT#48827) [Olivier Mengue]
+ - Fixed preservation of custom install_paths on resume (RT#41166)
+   [David Golden]
+ - Warn instead of crashing when Pod::Man tries to create files with
+   colons on vfat partitions on unix (RT#45544) [David Golden]
+
+0.34_05 - Sun Aug  9 22:31:37 EDT 2009
+
+ Bug fixes:
+ - When auto_configure_requires is true (the default), Module::Build will 
+   only add last 'major' version of Module:Build (e.g. 0.XX) to
+   configure_requires to avoid specifying a minor development release not
+   available on CPAN [David Golden]
+
+0.34_04 - Sat Aug  8 11:02:24 EDT 2009
+
+ Other:
+ - Added documentation warning that 'get_options' should be capitalized
+   to avoid conflicting with future Module::Build options and changed
+   the examples accordingly.
+
+0.34_03 - Sat Aug  8 07:39:16 EDT 2009
+
+ Bug fixes:
+ - Fixed failing xs.t if /tmp is mounted noexec (RT#47331) [David Golden]
+ - Fixed failing debug.t on VMS (RT#48362) [Craig Berry]
+ - Prevent par.t from dying on error in .zip extraction [David Golden]
+ - Fixed potential runthrough.t failure on 5.6.2 [David Golden]
+
+ Other:
+ - Archive::Tar changed from 'requires' to 'recommends' so non-authors
+   without IO::Zlib can still use Module::Build to install modules
+   [reported by Matt Trout, fix by David Golden]
+
 0.340201 - Sun Aug  9 22:11:04 EDT 2009
 
  Other:
@@ -9,7 +52,7 @@
 
  Bug-fixes:
  - Bundled Module::Build::Version updated to bring into sync with CPAN
-   version.pm 0.77
+   version.pm 0.77 [John Peacock]
 
 0.34_01 - Sat Jul 18 16:32:09 EDT 2009
 
diff -urN perl-5.10.1.orig/lib/Module/Build/Compat.pm perl-5.10.1/lib/Module/Build/Compat.pm
--- perl-5.10.1.orig/lib/Module/Build/Compat.pm	2009-12-01 17:01:57.000000000 +0100
+++ perl-5.10.1/lib/Module/Build/Compat.pm	2009-12-01 11:51:27.000000000 +0100
@@ -2,7 +2,7 @@
 
 use strict;
 use vars qw($VERSION);
-$VERSION = '0.340201';
+$VERSION = '0.35';
 
 use File::Basename ();
 use File::Spec;
@@ -318,7 +318,9 @@
   my $unlink = $class->oneliner('1 while unlink $ARGV[0]', [], [$args{makefile}]);
   $unlink =~ s/\$/\$\$/g unless $class->is_vmsish;
 
-  my $maketext = <<"EOF";
+  my $maketext = ($^O eq 'os2' ? "SHELL = sh\n\n" : '');
+
+  $maketext .= <<"EOF";
 all : force_do_it
 	$perl $Build
 realclean : force_do_it
diff -urN perl-5.10.1.orig/lib/Module/Build/Config.pm perl-5.10.1/lib/Module/Build/Config.pm
--- perl-5.10.1.orig/lib/Module/Build/Config.pm	2009-12-01 17:01:57.000000000 +0100
+++ perl-5.10.1/lib/Module/Build/Config.pm	2009-12-01 11:51:27.000000000 +0100
@@ -2,7 +2,7 @@
 
 use strict;
 use vars qw($VERSION);
-$VERSION = '0.340201';
+$VERSION = '0.35';
 $VERSION = eval $VERSION;
 use Config;
 
diff -urN perl-5.10.1.orig/lib/Module/Build/Cookbook.pm perl-5.10.1/lib/Module/Build/Cookbook.pm
--- perl-5.10.1.orig/lib/Module/Build/Cookbook.pm	2009-12-01 17:01:57.000000000 +0100
+++ perl-5.10.1/lib/Module/Build/Cookbook.pm	2009-12-01 11:51:27.000000000 +0100
@@ -1,7 +1,7 @@
 package Module::Build::Cookbook;
 use strict;
 use vars qw($VERSION);
-$VERSION = '0.340201';
+$VERSION = '0.35';
 
 
 =head1 NAME
diff -urN perl-5.10.1.orig/lib/Module/Build/Dumper.pm perl-5.10.1/lib/Module/Build/Dumper.pm
--- perl-5.10.1.orig/lib/Module/Build/Dumper.pm	2009-12-01 17:01:57.000000000 +0100
+++ perl-5.10.1/lib/Module/Build/Dumper.pm	2009-12-01 11:51:27.000000000 +0100
@@ -1,7 +1,7 @@
 package Module::Build::Dumper;
 use strict;
 use vars qw($VERSION);
-$VERSION = '0.340201';
+$VERSION = '0.35';
 
 # This is just a split-out of a wrapper function to do Data::Dumper
 # stuff "the right way".  See:
diff -urN perl-5.10.1.orig/lib/Module/Build/ModuleInfo.pm perl-5.10.1/lib/Module/Build/ModuleInfo.pm
--- perl-5.10.1.orig/lib/Module/Build/ModuleInfo.pm	2009-12-01 17:01:57.000000000 +0100
+++ perl-5.10.1/lib/Module/Build/ModuleInfo.pm	2009-12-01 11:51:27.000000000 +0100
@@ -8,7 +8,7 @@
 
 use strict;
 use vars qw($VERSION);
-$VERSION = '0.340201';
+$VERSION = '0.35';
 $VERSION = eval $VERSION;
 
 use File::Spec;
diff -urN perl-5.10.1.orig/lib/Module/Build/Notes.pm perl-5.10.1/lib/Module/Build/Notes.pm
--- perl-5.10.1.orig/lib/Module/Build/Notes.pm	2009-12-01 17:01:57.000000000 +0100
+++ perl-5.10.1/lib/Module/Build/Notes.pm	2009-12-01 11:51:27.000000000 +0100
@@ -4,7 +4,7 @@
 
 use strict;
 use vars qw($VERSION);
-$VERSION = '0.340201';
+$VERSION = '0.35';
 $VERSION = eval $VERSION;
 use Data::Dumper;
 use IO::File;
diff -urN perl-5.10.1.orig/lib/Module/Build/PPMMaker.pm perl-5.10.1/lib/Module/Build/PPMMaker.pm
--- perl-5.10.1.orig/lib/Module/Build/PPMMaker.pm	2009-12-01 17:01:57.000000000 +0100
+++ perl-5.10.1/lib/Module/Build/PPMMaker.pm	2009-12-01 11:51:27.000000000 +0100
@@ -2,7 +2,7 @@
 
 use strict;
 use vars qw($VERSION);
-$VERSION = '0.340201';
+$VERSION = '0.35';
 $VERSION = eval $VERSION;
 
 # This code is mostly borrowed from ExtUtils::MM_Unix 6.10_03, with a
@@ -113,6 +113,7 @@
   my $ppd_file = "$dist{name}.ppd";
   my $fh = IO::File->new(">$ppd_file")
     or die "Cannot write to $ppd_file: $!";
+  $fh->binmode(":utf8") if $fh->can("binmode");
   print $fh $ppd;
   close $fh;
 
diff -urN perl-5.10.1.orig/lib/Module/Build/Platform/Amiga.pm perl-5.10.1/lib/Module/Build/Platform/Amiga.pm
--- perl-5.10.1.orig/lib/Module/Build/Platform/Amiga.pm	2009-12-01 17:01:57.000000000 +0100
+++ perl-5.10.1/lib/Module/Build/Platform/Amiga.pm	2009-12-01 11:51:27.000000000 +0100
@@ -2,7 +2,7 @@
 
 use strict;
 use vars qw($VERSION);
-$VERSION = '0.340201';
+$VERSION = '0.35';
 $VERSION = eval $VERSION;
 use Module::Build::Base;
 
diff -urN perl-5.10.1.orig/lib/Module/Build/Platform/Default.pm perl-5.10.1/lib/Module/Build/Platform/Default.pm
--- perl-5.10.1.orig/lib/Module/Build/Platform/Default.pm	2009-12-01 17:01:57.000000000 +0100
+++ perl-5.10.1/lib/Module/Build/Platform/Default.pm	2009-12-01 11:51:27.000000000 +0100
@@ -2,7 +2,7 @@
 
 use strict;
 use vars qw($VERSION);
-$VERSION = '0.340201';
+$VERSION = '0.35';
 $VERSION = eval $VERSION;
 use Module::Build::Base;
 
diff -urN perl-5.10.1.orig/lib/Module/Build/Platform/EBCDIC.pm perl-5.10.1/lib/Module/Build/Platform/EBCDIC.pm
--- perl-5.10.1.orig/lib/Module/Build/Platform/EBCDIC.pm	2009-12-01 17:01:57.000000000 +0100
+++ perl-5.10.1/lib/Module/Build/Platform/EBCDIC.pm	2009-12-01 11:51:27.000000000 +0100
@@ -2,7 +2,7 @@
 
 use strict;
 use vars qw($VERSION);
-$VERSION = '0.340201';
+$VERSION = '0.35';
 $VERSION = eval $VERSION;
 use Module::Build::Base;
 
diff -urN perl-5.10.1.orig/lib/Module/Build/Platform/MPEiX.pm perl-5.10.1/lib/Module/Build/Platform/MPEiX.pm
--- perl-5.10.1.orig/lib/Module/Build/Platform/MPEiX.pm	2009-12-01 17:01:57.000000000 +0100
+++ perl-5.10.1/lib/Module/Build/Platform/MPEiX.pm	2009-12-01 11:51:27.000000000 +0100
@@ -2,7 +2,7 @@
 
 use strict;
 use vars qw($VERSION);
-$VERSION = '0.340201';
+$VERSION = '0.35';
 $VERSION = eval $VERSION;
 use Module::Build::Base;
 
diff -urN perl-5.10.1.orig/lib/Module/Build/Platform/MacOS.pm perl-5.10.1/lib/Module/Build/Platform/MacOS.pm
--- perl-5.10.1.orig/lib/Module/Build/Platform/MacOS.pm	2009-12-01 17:01:57.000000000 +0100
+++ perl-5.10.1/lib/Module/Build/Platform/MacOS.pm	2009-12-01 11:51:27.000000000 +0100
@@ -2,7 +2,7 @@
 
 use strict;
 use vars qw($VERSION);
-$VERSION = '0.340201';
+$VERSION = '0.35';
 $VERSION = eval $VERSION;
 use Module::Build::Base;
 use vars qw(@ISA);
diff -urN perl-5.10.1.orig/lib/Module/Build/Platform/RiscOS.pm perl-5.10.1/lib/Module/Build/Platform/RiscOS.pm
--- perl-5.10.1.orig/lib/Module/Build/Platform/RiscOS.pm	2009-12-01 17:01:57.000000000 +0100
+++ perl-5.10.1/lib/Module/Build/Platform/RiscOS.pm	2009-12-01 11:51:27.000000000 +0100
@@ -2,7 +2,7 @@
 
 use strict;
 use vars qw($VERSION);
-$VERSION = '0.340201';
+$VERSION = '0.35';
 $VERSION = eval $VERSION;
 use Module::Build::Base;
 
diff -urN perl-5.10.1.orig/lib/Module/Build/Platform/Unix.pm perl-5.10.1/lib/Module/Build/Platform/Unix.pm
--- perl-5.10.1.orig/lib/Module/Build/Platform/Unix.pm	2009-12-01 17:01:57.000000000 +0100
+++ perl-5.10.1/lib/Module/Build/Platform/Unix.pm	2009-12-01 11:51:27.000000000 +0100
@@ -2,7 +2,7 @@
 
 use strict;
 use vars qw($VERSION);
-$VERSION = '0.340201';
+$VERSION = '0.35';
 $VERSION = eval $VERSION;
 use Module::Build::Base;
 
diff -urN perl-5.10.1.orig/lib/Module/Build/Platform/VMS.pm perl-5.10.1/lib/Module/Build/Platform/VMS.pm
--- perl-5.10.1.orig/lib/Module/Build/Platform/VMS.pm	2009-12-01 17:01:57.000000000 +0100
+++ perl-5.10.1/lib/Module/Build/Platform/VMS.pm	2009-12-01 11:51:27.000000000 +0100
@@ -2,7 +2,7 @@
 
 use strict;
 use vars qw($VERSION);
-$VERSION = '0.340201';
+$VERSION = '0.35';
 $VERSION = eval $VERSION;
 use Module::Build::Base;
 
diff -urN perl-5.10.1.orig/lib/Module/Build/Platform/VOS.pm perl-5.10.1/lib/Module/Build/Platform/VOS.pm
--- perl-5.10.1.orig/lib/Module/Build/Platform/VOS.pm	2009-12-01 17:01:57.000000000 +0100
+++ perl-5.10.1/lib/Module/Build/Platform/VOS.pm	2009-12-01 11:51:27.000000000 +0100
@@ -2,7 +2,7 @@
 
 use strict;
 use vars qw($VERSION);
-$VERSION = '0.340201';
+$VERSION = '0.35';
 $VERSION = eval $VERSION;
 use Module::Build::Base;
 
diff -urN perl-5.10.1.orig/lib/Module/Build/Platform/Windows.pm perl-5.10.1/lib/Module/Build/Platform/Windows.pm
--- perl-5.10.1.orig/lib/Module/Build/Platform/Windows.pm	2009-12-01 17:01:57.000000000 +0100
+++ perl-5.10.1/lib/Module/Build/Platform/Windows.pm	2009-12-01 11:51:27.000000000 +0100
@@ -2,7 +2,7 @@
 
 use strict;
 use vars qw($VERSION);
-$VERSION = '0.340201';
+$VERSION = '0.35';
 $VERSION = eval $VERSION;
 
 use Config;
diff -urN perl-5.10.1.orig/lib/Module/Build/Platform/aix.pm perl-5.10.1/lib/Module/Build/Platform/aix.pm
--- perl-5.10.1.orig/lib/Module/Build/Platform/aix.pm	2009-12-01 17:01:57.000000000 +0100
+++ perl-5.10.1/lib/Module/Build/Platform/aix.pm	2009-12-01 11:51:27.000000000 +0100
@@ -2,7 +2,7 @@
 
 use strict;
 use vars qw($VERSION);
-$VERSION = '0.340201';
+$VERSION = '0.35';
 $VERSION = eval $VERSION;
 use Module::Build::Platform::Unix;
 
diff -urN perl-5.10.1.orig/lib/Module/Build/Platform/cygwin.pm perl-5.10.1/lib/Module/Build/Platform/cygwin.pm
--- perl-5.10.1.orig/lib/Module/Build/Platform/cygwin.pm	2009-12-01 17:01:57.000000000 +0100
+++ perl-5.10.1/lib/Module/Build/Platform/cygwin.pm	2009-12-01 11:51:27.000000000 +0100
@@ -2,7 +2,7 @@
 
 use strict;
 use vars qw($VERSION);
-$VERSION = '0.340201';
+$VERSION = '0.35';
 $VERSION = eval $VERSION;
 use Module::Build::Platform::Unix;
 
diff -urN perl-5.10.1.orig/lib/Module/Build/Platform/darwin.pm perl-5.10.1/lib/Module/Build/Platform/darwin.pm
--- perl-5.10.1.orig/lib/Module/Build/Platform/darwin.pm	2009-12-01 17:01:57.000000000 +0100
+++ perl-5.10.1/lib/Module/Build/Platform/darwin.pm	2009-12-01 11:51:27.000000000 +0100
@@ -2,7 +2,7 @@
 
 use strict;
 use vars qw($VERSION);
-$VERSION = '0.340201';
+$VERSION = '0.35';
 $VERSION = eval $VERSION;
 use Module::Build::Platform::Unix;
 
diff -urN perl-5.10.1.orig/lib/Module/Build/Platform/os2.pm perl-5.10.1/lib/Module/Build/Platform/os2.pm
--- perl-5.10.1.orig/lib/Module/Build/Platform/os2.pm	2009-12-01 17:01:57.000000000 +0100
+++ perl-5.10.1/lib/Module/Build/Platform/os2.pm	2009-12-01 11:51:27.000000000 +0100
@@ -2,7 +2,7 @@
 
 use strict;
 use vars qw($VERSION);
-$VERSION = '0.340201';
+$VERSION = '0.35';
 $VERSION = eval $VERSION;
 use Module::Build::Platform::Unix;
 
diff -urN perl-5.10.1.orig/lib/Module/Build/PodParser.pm perl-5.10.1/lib/Module/Build/PodParser.pm
--- perl-5.10.1.orig/lib/Module/Build/PodParser.pm	2009-12-01 17:01:57.000000000 +0100
+++ perl-5.10.1/lib/Module/Build/PodParser.pm	2009-12-01 11:51:27.000000000 +0100
@@ -2,7 +2,7 @@
 
 use strict;
 use vars qw($VERSION);
-$VERSION = '0.340201';
+$VERSION = '0.35';
 $VERSION = eval $VERSION;
 use vars qw(@ISA);
 
diff -urN perl-5.10.1.orig/lib/Module/Build/t/PL_files.t perl-5.10.1/lib/Module/Build/t/PL_files.t
--- perl-5.10.1.orig/lib/Module/Build/t/PL_files.t	2009-12-01 17:01:57.000000000 +0100
+++ perl-5.10.1/lib/Module/Build/t/PL_files.t	2009-12-01 11:53:14.000000000 +0100
@@ -82,5 +82,5 @@
     my %cleanup = map { $_ => 1 } $mb->cleanup;
     is($cleanup{foo}, undef, "generated special file not added to cleanup");
 
-
+    $dist->chdir_original if $dist->did_chdir;
 }
diff -urN perl-5.10.1.orig/lib/Module/Build/t/add_property.t perl-5.10.1/lib/Module/Build/t/add_property.t
--- perl-5.10.1.orig/lib/Module/Build/t/add_property.t	2009-12-01 17:01:57.000000000 +0100
+++ perl-5.10.1/lib/Module/Build/t/add_property.t	2009-12-01 11:53:14.000000000 +0100
@@ -91,3 +91,5 @@
 ok $err = $@, 'Should catch exception for invalid "installdirs" value';
 like $err, qr/ERROR: installdirs must be one of "core", "site", or "vendor"/,
   'And it should suggest the proper values in the error message';
+
+$dist->chdir_original if $dist->did_chdir;
diff -urN perl-5.10.1.orig/lib/Module/Build/t/compat.t perl-5.10.1/lib/Module/Build/t/compat.t
--- perl-5.10.1.orig/lib/Module/Build/t/compat.t	2009-12-01 17:01:57.000000000 +0100
+++ perl-5.10.1/lib/Module/Build/t/compat.t	2009-12-01 11:53:14.000000000 +0100
@@ -216,28 +216,46 @@
   my $libarch2 = File::Spec->catdir($libdir2, 'arch');
 
   SKIP: {
+    my @cases = (
+      {
+        label => "INSTALLDIRS=vendor",
+        args => [ 'INSTALLDIRS=vendor', "INSTALLVENDORLIB=$libdir2", "INSTALLVENDORARCH=$libarch2"],
+        check => qr/\Q$libdir2\E .* Simple\.pm/ix,
+      },
+      {
+        label => "PREFIX=\$libdir2",
+        args => [ "PREFIX=$libdir2"],
+        check => qr/\Q$libdir2\E .* Simple\.pm/ix,
+      },
+      {
+        label => "PREFIX=\$libdir2 LIB=mylib",
+        args => [ "PREFIX=$libdir2", "LIB=mylib" ],
+        check => qr{\Q$libdir2\E[/\\]mylib[/\\]Simple\.pm}ix,
+      },
+    );
+
     require ExtUtils::Install;
-    skip "Needs ExtUtils::Install 1.32 or later", 2
+    skip "Needs ExtUtils::Install 1.32 or later", 2 * @cases
       if ExtUtils::Install->VERSION < 1.32;
 
-    my @make_args = ('INSTALLDIRS=vendor', "INSTALLVENDORLIB=$libdir2", "INSTALLVENDORARCH=$libarch2");
-
-    if ($is_vms_mms) { # VMS MMK/MMS macros use different syntax.
-      $make_args[0] = '/macro=("' . join('","',@make_args) . '")';
-      pop @make_args while scalar(@make_args) > 1;
-    }
-
-    ($output) = stdout_stderr_of(
-      sub {
-        $ran_ok = $mb->do_system(@make, 'fakeinstall', @make_args);
+    for my $c (@cases) {
+      my @make_args = @{$c->{args}}; 
+      if ($is_vms_mms) { # VMS MMK/MMS macros use different syntax.
+        $make_args[0] = '/macro=("' . join('","',@make_args) . '")';
+        pop @make_args while scalar(@make_args) > 1;
       }
-    );
-
-    ok $ran_ok, "make fakeinstall with INSTALLDIRS=vendor ran ok";
-    $output =~ s/^/# /gm;  # Don't confuse our own test output
-    like $output,
-        qr/\Q$libdir2\E .* Simple\.pm/ix,
-        'Should have installdirs=vendor';
+      ($output) = stdout_stderr_of(
+        sub {
+          $result = $mb->run_perl_script('Makefile.PL', [], \@make_args);
+          $ran_ok = $mb->do_system(@make, 'fakeinstall');
+        }
+      );
+
+      ok $ran_ok, "fakeinstall $c->{label} ran ok";
+      $output =~ s/^/# /gm;  # Don't confuse our own test output
+      like $output, $c->{check},
+          "Saw destination directory for $c->{label}";
+    }
   }
 
   stdout_of( sub { $mb->do_system(@make, 'realclean'); } );
diff -urN perl-5.10.1.orig/lib/Module/Build/t/debug.t perl-5.10.1/lib/Module/Build/t/debug.t
--- perl-5.10.1.orig/lib/Module/Build/t/debug.t	2009-12-01 17:01:57.000000000 +0100
+++ perl-5.10.1/lib/Module/Build/t/debug.t	2009-12-01 11:53:14.000000000 +0100
@@ -21,12 +21,8 @@
 # Test debug output
 {
   my $output;
-  $output = stdout_of sub {
-    Module::Build->run_perl_script('Build.PL', [], [])
-  };
-  $output = stdout_of sub {
-    Module::Build->run_perl_script('Build', [], ['--debug'])
-  };
+  $output = stdout_of sub { $dist->run_build_pl };
+  $output = stdout_of sub { $dist->run_build('--debug') };
   like($output, '/Starting ACTION_build.*?Starting ACTION_code.*?Finished ACTION_code.*?Finished ACTION_build/ms',
     "found nested ACTION_* debug statements"
   );
diff -urN perl-5.10.1.orig/lib/Module/Build/t/destinations.t perl-5.10.1/lib/Module/Build/t/destinations.t
--- perl-5.10.1.orig/lib/Module/Build/t/destinations.t	2009-12-01 17:01:57.000000000 +0100
+++ perl-5.10.1/lib/Module/Build/t/destinations.t	2009-12-01 11:53:14.000000000 +0100
@@ -248,13 +248,14 @@
     }
 
     # Poke at the innards of MB to change the default install locations.
-    local $mb->install_sets->{site} = \%test_config;
+    my $old =  $mb->install_sets->{site} = \%test_config;
     $mb->config(siteprefixexp => catdir(File::Spec->rootdir, 
 					'wierd', 'prefix'));
 
     my $prefix = catdir('another', 'prefix');
     $mb->prefix($prefix);
     test_prefix($prefix, \%test_config);
+    $mb->install_sets->{site} = $old;
 }
 
 
diff -urN perl-5.10.1.orig/lib/Module/Build/t/help.t perl-5.10.1/lib/Module/Build/t/help.t
--- perl-5.10.1.orig/lib/Module/Build/t/help.t	2009-12-01 17:01:57.000000000 +0100
+++ perl-5.10.1/lib/Module/Build/t/help.t	2009-12-01 11:53:14.000000000 +0100
@@ -22,7 +22,7 @@
 
 my $restart = sub {
   $dist->clean();
-  chdir( $cwd );
+  DistGen::chdir_all( $cwd );
   File::Path::rmtree( $tmp );
   # we're redefining the same package as we go, so...
   delete($::{'MyModuleBuilder::'});
@@ -274,7 +274,7 @@
 
 # cleanup
 $dist->clean();
-chdir( $cwd );
+DistGen::chdir_all($cwd);
 File::Path::rmtree( $tmp );
 
 # vim:ts=2:sw=2:et:sta
diff -urN perl-5.10.1.orig/lib/Module/Build/t/install_extra_target.t perl-5.10.1/lib/Module/Build/t/install_extra_target.t
--- perl-5.10.1.orig/lib/Module/Build/t/install_extra_target.t	1970-01-01 01:00:00.000000000 +0100
+++ perl-5.10.1/lib/Module/Build/t/install_extra_target.t	2009-08-27 15:19:29.000000000 +0200
@@ -0,0 +1,137 @@
+#!perl -w
+# Contributed by: Thorben Jaendling
+
+use strict;
+use lib $ENV{PERL_CORE} ? '../lib/Module/Build/t/lib' : 't/lib';
+use MBTest tests => 8;
+
+require_ok 'Module::Build';
+ensure_blib('Module::Build');
+
+use File::Spec::Functions qw( catdir );
+
+my $tmp = MBTest->tmpdir;
+my $output;
+
+use DistGen;
+my $dist = DistGen->new( dir => $tmp );
+
+# note("Dist is in $tmp\n");
+
+$dist->add_file("Build.PL", <<'===EOF===');
+#!perl -w
+
+use strict;
+use Module::Build;
+
+my $subclass = Module::Build->subclass(code => <<'=EOF=');
+sub copy_files
+{
+	my $self = shift;
+	my $dir = shift;
+
+	my $files = $self->rscan_dir($dir, sub {-f $_ and not m!/\.|[#~]$!});
+
+	foreach my $file (@$files) {
+		$self->copy_if_modified(from => $file, to_dir => "blib");
+	}
+}
+
+#Copy etc files to blib
+sub process_etc_files
+{
+	my $self = shift;
+
+	$self->copy_files("etc");
+}
+
+#Copy share files to blib
+sub process_share_files
+{
+	my $self = shift;
+
+	$self->copy_files("share");
+}
+
+1;
+=EOF=
+
+my $build = $subclass->new(
+	module_name => 'Simple',
+	license     => 'perl'
+);
+
+$build->add_build_element('etc');
+$build->add_build_element('share');
+
+my $distdir = lc $build->dist_name();
+
+foreach my $id ('core', 'site', 'vendor') {
+	#Where to install these build types when using prefix symantics
+	$build->prefix_relpaths($id, 'share' => "share/$distdir");
+	$build->prefix_relpaths($id, 'etc' => "etc/$distdir");
+
+	#Where to install these build types when using default symantics
+	my $set = $build->install_sets($id);
+	$set->{'share'} = '/usr/'.($id eq 'site' ? 'local/':'')."share/$distdir";
+	$set->{'etc'} = ($id eq 'site' ? '/usr/local/etc/':'/etc/').$distdir;
+}
+
+#Where to install these types when using install_base symantics
+$build->install_base_relpaths('share' => "share/$distdir");
+$build->install_base_relpaths('etc' => "etc/$distdir");
+
+$build->create_build_script();
+
+===EOF===
+	
+#Test Build.PL exists ok?
+
+$dist->add_file("etc/config", <<'===EOF===');
+[main]
+Foo = bar
+Jim = bob
+
+[supplemental]
+stardate = 1234344
+
+===EOF===
+
+$dist->add_file("share/data", <<'===EOF===');
+7 * 9 = 42?
+
+===EOF===
+
+$dist->add_file("share/html/index.html", <<'===EOF===');
+<HTML>
+  <BODY>
+    <H1>Hello World!</H1>
+  </BODY>
+</HTML>
+
+===EOF===
+
+$dist->regen;
+$dist->chdir_in;
+
+my $installdest = catdir($tmp, 't', "install_extra_targets-$$");
+
+$output = stdout_of sub { $dist->run_build_pl("--install_base=$installdest") };
+
+$output .= stdout_of sub { $dist->run_build };
+
+my $error;
+$error++ unless ok(-e "blib/etc/config", "Built etc/config");
+$error++ unless ok(-e "blib/share/data", "Built share/data");
+$error++ unless ok(-e "blib/share/html/index.html", "Built share/html");
+diag "OUTPUT:\n$output" if $error;
+
+$output = stdout_of sub { $dist->run_build('install') };
+
+$error = 0;
+$error++ unless ok(-e "$installdest/etc/simple/config", "installed etc/config");
+$error++ unless ok(-e "$installdest/share/simple/data", "installed share/data");
+$error++ unless ok(-e "$installdest/share/simple/html/index.html", "installed share/html");
+diag "OUTPUT:\n$output" if $error;
+
+$dist->remove();
diff -urN perl-5.10.1.orig/lib/Module/Build/t/lib/DistGen.pm perl-5.10.1/lib/Module/Build/t/lib/DistGen.pm
--- perl-5.10.1.orig/lib/Module/Build/t/lib/DistGen.pm	2009-12-01 17:01:57.000000000 +0100
+++ perl-5.10.1/lib/Module/Build/t/lib/DistGen.pm	2009-12-01 11:53:14.000000000 +0100
@@ -62,6 +62,13 @@
 
   return($string);
 }
+
+sub chdir_all ($) {
+  # OS/2 has "current directory per disk", undeletable; 
+  # doing chdir() to another disk won't change cur-dir of initial disk...
+  chdir('/') if $^O eq 'os2';
+  chdir shift;
+}
 ########################################################################
 
 sub new {
@@ -72,7 +79,7 @@
   $options{dir}  ||= Cwd::cwd();
 
   my %data = (
-    skip_manifest => 0,
+    no_manifest   => 0,
     xs            => 0,
     %options,
   );
@@ -286,7 +293,7 @@
       my $real_filename = $self->_real_filename( $file );
       my $fullname = File::Spec->catfile( $dist_dirname, $real_filename );
       if ( -e $fullname ) {
-	1 while unlink( $fullname );
+        1 while unlink( $fullname );
       }
       print "Unlinking pending file '$file'\n" if $VERBOSE;
       delete( $self->{pending}{remove}{$file} );
@@ -297,8 +304,8 @@
     my $real_filename = $self->_real_filename( $file );
     my $fullname = File::Spec->catfile( $dist_dirname, $real_filename );
 
-    if ( ! -e $fullname ||
-	 ( -e $fullname && $self->{pending}{change}{$file} ) ) {
+    if  ( ! -e $fullname ||
+        (   -e $fullname && $self->{pending}{change}{$file} ) ) {
 
       print "Changed file '$file'.\n" if $VERBOSE;
 
@@ -326,7 +333,7 @@
   }
 
   my $manifest = File::Spec->catfile( $dist_dirname, 'MANIFEST' );
-  unless ( $self->{skip_manifest} ) {
+  unless ( $self->{no_manifest} ) {
     if ( -e $manifest ) {
       1 while unlink( $manifest );
     }
@@ -388,7 +395,7 @@
     }
   }, ($^O eq 'VMS' ? './' : File::Spec->curdir) );
 
-  chdir( $here );
+  chdir_all( $here );
 }
 
 sub remove {
@@ -478,10 +485,23 @@
 
   croak("never called chdir_in()") unless($self->{original_dir});
   my $dir = $self->{original_dir};
-  chdir($dir) or die "Can't chdir to '$dir': $!";
+  chdir_all($dir) or die "Can't chdir to '$dir': $!";
 }
 ########################################################################
 
+sub run_build_pl {
+  my ($self, @args) = @_;
+  require Module::Build;
+  Module::Build->run_perl_script('Build.PL', [], [@args])
+}
+
+sub run_build {
+  my ($self, @args) = @_;
+  require Module::Build;
+  my $build_script = $^O eq 'VMS' ? 'Build.com' : 'Build';
+  Module::Build->run_perl_script($build_script, [], [@args])
+}
+
 1;
 
 __END__
@@ -495,20 +515,59 @@
 
   use DistGen;
 
-  my $dist = DistGen->new(dir => $tmp);
-  ...
+  # create distribution and prepare to test
+  my $dist = DistGen->new(name => 'Foo::Bar', dir => $tmp);
+  $dist->regen;
+  $dist->chdir_in;
+
+  # change distribution files
   $dist->add_file('t/some_test.t', $contents);
-  ...
+  $dist->change_file('MANIFEST.SKIP', $new_contents);
+  $dist->remove_file('t/some_test.t');
   $dist->regen;
 
-  chdir($dist->dirname) or
-    die "Cannot chdir to '@{[$dist->dirname]}': $!";
-  ...
+  # clean up extraneous files
   $dist->clean;
-  ...
-  chdir($cwd) or die "cannot return to $cwd";
+
+  # exercise the command-line interface
+  $dist->run_build_pl();
+  $dist->run_build('test');
+
+  # finish testing and clean up
+  $dist->chdir_original;
   $dist->remove;
 
+=head1 USAGE
+
+A DistGen object manages a set of files in a distribution directory.
+
+The constructor and some methods only define the target state of the
+distribution.  They do B<not> make any changes to the filesystem:
+
+  new
+  add_file
+  change_file
+  change_build_pl
+  remove_file
+
+Other methods then change the filesystem to match the target state of
+the distribution (or to remove it entirely):
+
+  regen
+  clean
+  remove
+
+Other methods are provided for a convenience during testing. The
+most important are ones that manage the current directory:
+
+  chdir_in
+  chdir_original
+
+Additional methods portably encapsulate running Build.PL and Build:
+
+  run_build_pl
+  run_build
+
 =head1 API
 
 =head2 Constructor
@@ -519,9 +578,10 @@
 
   my $tmp = MBTest->tmpdir;
   my $dist = DistGen->new(
-    name => 'Foo::Bar',
-    dir  => $tmp,
-    xs   => 1,
+    name        => 'Foo::Bar',
+    dir         => $tmp,
+    xs          => 1,
+    no_manifest => 0,
   );
 
 The parameters are as follows.
@@ -544,33 +604,84 @@
 
 If true, generates an XS based module.
 
+=item no_manifest
+
+If true, C<regen()> will not create a MANIFEST file.
+
 =back
 
-=head2 Manipulating the Distribution
+The following files are added as part of the default distribution:
 
-These methods immediately affect the filesystem.
+  Build.PL
+  lib/Simple.pm # based on name parameter
+  t/basic.t
 
-=head3 regen()
+If an XS module is generated, Simple.pm and basic.t are different and
+the following files are also added:
 
-Regenerate all missing or changed files.
+  typemap
+  lib/Simple.xs # based on name parameter
 
-  $dist->regen(clean => 1);
+=head2 Adding and editing files
 
-If the optional C<clean> argument is given, it also removes any
-extraneous files that do not belong to the distribution.
+Note that C<$filename> should always be specified with unix-style paths,
+and are relative to the distribution root directory, e.g. C<lib/Module.pm>.
 
-=head2 chdir_in
+No changes are made to the filesystem until the distribution is regenerated.
 
-Change directory into the dist root.
+=head3 add_file()
 
-  $dist->chdir_in;
+Add a $filename containing $content to the distribution.
 
-=head2 chdir_original
+  $dist->add_file( $filename, $content );
 
-Returns to whatever directory you were in before chdir_in() (regardless
-of the cwd.)
+=head3 change_file()
 
-  $dist->chdir_original;
+Changes the contents of $filename to $content. No action is performed
+until the distribution is regenerated.
+
+  $dist->change_file( $filename, $content );
+
+=head3 change_build_pl()
+
+A wrapper around change_file specifically for setting Build.PL.  Instead
+of file C<$content>, it takes a hash-ref of Module::Build constructor
+arguments:
+
+  $dist->change_build_pl(
+    {
+      module_name         => $dist->name,
+      dist_version        => '3.14159265',
+      license             => 'perl',
+      create_readme       => 1,
+    }
+  );
+
+=head3 get_file
+
+Retrieves the target contents of C<$filename>.
+
+  $content = $dist->get_file( $filename );
+
+=head3 remove_file()
+
+Removes C<$filename> from the distribution.
+
+  $dist->remove_file( $filename );
+
+=head2 Changing the distribution directory
+
+These methods immediately affect the filesystem.
+
+=head3 regen()
+
+Regenerate all missing or changed files.  Also deletes any files
+flagged for removal with remove_file().
+
+  $dist->regen(clean => 1);
+
+If the optional C<clean> argument is given, it also removes any
+extraneous files that do not belong to the distribution.
 
 =head3 clean()
 
@@ -595,31 +706,41 @@
 
 Removes the entire distribution directory.
 
-=head2 Editing Files
+=head2 Changing directories
 
-Note that C<$filename> should always be specified with unix-style paths,
-and are relative to the distribution root directory, e.g. C<lib/Module.pm>.
+=head3 chdir_in
 
-No filesystem action is performed until the distribution is regenerated.
+Change directory into the dist root.
 
-=head3 add_file()
+  $dist->chdir_in;
 
-Add a $filename containing $content to the distribution.
+=head3 chdir_original
 
-  $dist->add_file( $filename, $content );
+Returns to whatever directory you were in before chdir_in() (regardless
+of the cwd.)
 
-=head3 remove_file()
+  $dist->chdir_original;
 
-Removes C<$filename> from the distribution.
+=head2 Command-line helpers
 
-  $dist->remove_file( $filename );
+These use Module::Build->run_perl_script() to ensure that Build.PL or Build are
+run in a separate process using the current perl interpreter.  (Module::Build
+is loaded on demand).  They also ensure appropriate naming for operating
+systems that require a suffix for Build.
 
-=head3 change_file()
+=head3 run_build_pl
 
-Changes the contents of $filename to $content. No action is performed
-until the distribution is regenerated.
+Runs Build.PL using the current perl interpreter.  Any arguments are
+passed on the command line.
 
-  $dist->change_file( $filename, $content );
+  $dist->run_build_pl('--quiet');
+
+=head3 run_build
+
+Runs Build using the current perl interpreter.  Any arguments are
+passed on the command line.
+
+  $dist->run_build(qw/test --verbose/);
 
 =head2 Properties
 
@@ -627,6 +748,8 @@
 
 Returns the name of the distribution.
 
+  $dist->name: # e.g. Foo::Bar
+
 =head3 dirname()
 
 Returns the directory where the distribution is created.
diff -urN perl-5.10.1.orig/lib/Module/Build/t/lib/MBTest.pm perl-5.10.1/lib/Module/Build/t/lib/MBTest.pm
--- perl-5.10.1.orig/lib/Module/Build/t/lib/MBTest.pm	2009-12-01 17:01:57.000000000 +0100
+++ perl-5.10.1/lib/Module/Build/t/lib/MBTest.pm	2009-12-01 11:53:14.000000000 +0100
@@ -123,8 +123,10 @@
 
 # Setup a temp directory 
 sub tmpdir { 
+  my ($self, $usr_tmp) = @_;
   return File::Temp::tempdir( 'MB-XXXXXXXX', 
-    CLEANUP => 1, DIR => $ENV{PERL_CORE} ? Cwd::cwd : File::Spec->tmpdir
+    CLEANUP => 1, DIR => $ENV{PERL_CORE} ? Cwd::cwd : 
+                         $usr_tmp        ? $usr_tmp : File::Spec->tmpdir 
   );
 }
 
@@ -200,7 +202,20 @@
   my $have_c_compiler;
   stderr_of( sub {$have_c_compiler = $mb->have_c_compiler} );
 
-  return ($have_c_compiler, $mb->feature('C_support'));
+  # check noexec tmpdir
+  my $tmp_exec;
+  if ( $have_c_compiler ) {
+    my $dir = MBTest->tmpdir;
+    my $c_file = File::Spec->catfile($dir,'test.c');
+    open my $fh, ">", $c_file;
+    print {$fh} "int main() { return 0; }\n";
+    close $fh;
+    my $exe = $mb->cbuilder->link_executable(
+      objects => $mb->cbuilder->compile( source => $c_file )
+    );
+    $tmp_exec = 0 == system( $exe );
+  }
+  return ($have_c_compiler, $mb->feature('C_support'), $tmp_exec);
 }
 
 sub have_module {
diff -urN perl-5.10.1.orig/lib/Module/Build/t/metadata.t perl-5.10.1/lib/Module/Build/t/metadata.t
--- perl-5.10.1.orig/lib/Module/Build/t/metadata.t	2009-12-01 17:01:57.000000000 +0100
+++ perl-5.10.1/lib/Module/Build/t/metadata.t	2009-12-01 11:53:14.000000000 +0100
@@ -65,6 +65,9 @@
 
 {
   my $mb_prereq = { 'Module::Build' => $Module::Build::VERSION };
+  my $mb_config_req = { 
+    'Module::Build' => int($Module::Build::VERSION * 100)/100 
+  };
   my $node = $mb->prepare_metadata( {} );
 
   # exists() doesn't seem to work here
@@ -73,7 +76,7 @@
   is $node->{abstract}, $metadata{dist_abstract};
   is_deeply $node->{author}, $metadata{dist_author};
   is $node->{license}, $metadata{license};
-  is_deeply $node->{configure_requires}, $mb_prereq, 'Add M::B to configure_requires';
+  is_deeply $node->{configure_requires}, $mb_config_req, 'Add M::B to configure_requires';
   like $node->{generated_by}, qr{Module::Build};
   ok defined( $node->{'meta-spec'}{version} ),
       "'meta-spec' -> 'version' field present in META.yml";
diff -urN perl-5.10.1.orig/lib/Module/Build/t/metadata2.t perl-5.10.1/lib/Module/Build/t/metadata2.t
--- perl-5.10.1.orig/lib/Module/Build/t/metadata2.t	2009-12-01 17:01:57.000000000 +0100
+++ perl-5.10.1/lib/Module/Build/t/metadata2.t	2009-12-01 11:53:14.000000000 +0100
@@ -19,7 +19,7 @@
   skip( 'YAML_support feature is not enabled', 4 )
       unless Module::Build::ConfigData->feature('YAML_support');
 
-  my $dist = DistGen->new( dir => $tmp, skip_manifest => 1 );
+  my $dist = DistGen->new( dir => $tmp, no_manifest => 1 );
   $dist->regen;
 
   $dist->chdir_in;
diff -urN perl-5.10.1.orig/lib/Module/Build/t/runthrough.t perl-5.10.1/lib/Module/Build/t/runthrough.t
--- perl-5.10.1.orig/lib/Module/Build/t/runthrough.t	2009-12-01 17:01:57.000000000 +0100
+++ perl-5.10.1/lib/Module/Build/t/runthrough.t	2009-12-01 11:53:14.000000000 +0100
@@ -16,7 +16,6 @@
 
 use DistGen;
 my $dist = DistGen->new( dir => $tmp );
-$dist->remove_file( 't/basic.t' );
 $dist->change_build_pl
 ({
   module_name => 'Simple',
@@ -29,22 +28,6 @@
 #!perl -w
 print "Hello, World!\n";
 ---
-$dist->add_file( 'test.pl', <<'---' );
-#!/usr/bin/perl
-
-use Test;
-plan tests => 2;
-
-ok 1;
-
-require Module::Build;
-skip $ENV{PERL_CORE} && "no blib in core",
-  $INC{'Module/Build.pm'}, qr/blib/, 'Module::Build should be loaded from blib';
-
-print "# Cwd: ", Module::Build->cwd, "\n";
-print "# \@INC: (@INC)\n";
-print "Done.\n";  # t/compat.t looks for this
----
 $dist->add_file( 'lib/Simple/Script.PL', <<'---' );
 #!perl -w
 
@@ -116,9 +99,9 @@
 
   unless ($all_ok) {
     # We use diag() so Test::Harness doesn't get confused.
-    diag("vvvvvvvvvvvvvvvvvvvvv Simple/test.pl output vvvvvvvvvvvvvvvvvvvvv");
+    diag("vvvvvvvvvvvvvvvvvvvvv Simple/t/basic.t output vvvvvvvvvvvvvvvvvvvvv");
     diag($output);
-    diag("^^^^^^^^^^^^^^^^^^^^^ Simple/test.pl output ^^^^^^^^^^^^^^^^^^^^^");
+    diag("^^^^^^^^^^^^^^^^^^^^^ Simple/t/basic.t output ^^^^^^^^^^^^^^^^^^^^^");
   }
 }
 
@@ -150,10 +133,8 @@
   cmp_ok $1, '==', $mb->VERSION, "Check version used to create META.yml: $1 == " . $mb->VERSION;
 
   SKIP: {
-    skip( "not sure if we can create a tarball on this platform", 1 )
-      unless $mb->check_installed_version('Archive::Tar', 0) ||
-	     $mb->isa('Module::Build::Platform::Unix');
-
+    skip( "Archive::Tar 1.08+ not installed", 1 )
+      unless eval { require Archive::Tar && Archive::Tar->VERSION(1.08); 1 };
     $mb->add_to_cleanup($mb->dist_dir . ".tar.gz");
     eval {$mb->dispatch('dist')};
     is $@, '';
diff -urN perl-5.10.1.orig/lib/Module/Build/t/script_dist.t perl-5.10.1/lib/Module/Build/t/script_dist.t
--- perl-5.10.1.orig/lib/Module/Build/t/script_dist.t	2009-12-01 17:01:57.000000000 +0100
+++ perl-5.10.1/lib/Module/Build/t/script_dist.t	2009-12-01 11:53:14.000000000 +0100
@@ -77,3 +77,4 @@
   my $yml = YAML::LoadFile('META.yml');
   is_deeply($yml->{provides}, \%meta_provides);
 }
+$dist->chdir_original if $dist->did_chdir;
diff -urN perl-5.10.1.orig/lib/Module/Build/t/tilde.t perl-5.10.1/lib/Module/Build/t/tilde.t
--- perl-5.10.1.orig/lib/Module/Build/t/tilde.t	2009-12-01 17:01:57.000000000 +0100
+++ perl-5.10.1/lib/Module/Build/t/tilde.t	2009-12-01 11:53:14.000000000 +0100
@@ -55,10 +55,6 @@
 
     is( run_sample( $p => '~/foo' )->$p(),  "$home/foo" );
 
-    is( run_sample( $p => '~~'    )->$p(),  '~~' );
-
-    is( run_sample( $p => '~ foo' )->$p(),  '~ foo' );
-
     is( run_sample( $p => '~/ foo')->$p(),  "$home/ foo" );
       
     is( run_sample( $p => '~/fo o')->$p(),  "$home/fo o" );
@@ -91,6 +87,10 @@
 
     $mb->$p('~');
     is( $mb->$p(),      '~', 'API does not expand tildes' );
+
+    skip "On OS/2 EMX all users are equal", 2 if $^O eq 'os2';
+    is( run_sample( $p => '~~'    )->$p(),  '~~' );
+    is( run_sample( $p => '~ foo' )->$p(),  '~ foo' );
 }
 
 # Again, with named users
diff -urN perl-5.10.1.orig/lib/Module/Build/t/write_default_maniskip.t perl-5.10.1/lib/Module/Build/t/write_default_maniskip.t
--- perl-5.10.1.orig/lib/Module/Build/t/write_default_maniskip.t	2009-12-01 17:01:57.000000000 +0100
+++ perl-5.10.1/lib/Module/Build/t/write_default_maniskip.t	2009-12-01 11:53:14.000000000 +0100
@@ -5,11 +5,14 @@
 
 use lib $ENV{PERL_CORE} ? '../lib/Module/Build/t/lib' : 't/lib';
 use MBTest 'no_plan';
+use DistGen;
+use Cwd;
 
 use_ok 'Module::Build';
 ensure_blib 'Module::Build';
 
 {
+    my $cwd = Cwd::cwd;
     chdir MBTest->tmpdir();
 
     my $build = Module::Build->new(
@@ -34,4 +37,6 @@
     like $have, qr/^\Q$head\E/, "default MANIFEST.SKIP used";
     like $have, qr/^# Avoid Module::Build generated /ms, "Module::Build specific entries";
     like $have, qr/Foo-Bar-/, "distribution tarball entry";
+
+    DistGen::chdir_all($cwd);
 }
diff -urN perl-5.10.1.orig/lib/Module/Build/t/xs.t perl-5.10.1/lib/Module/Build/t/xs.t
--- perl-5.10.1.orig/lib/Module/Build/t/xs.t	2009-12-01 17:01:57.000000000 +0100
+++ perl-5.10.1/lib/Module/Build/t/xs.t	2009-12-01 11:53:14.000000000 +0100
@@ -6,8 +6,10 @@
 use Module::Build;
 use Config;
 
+my $tmp;
+
 {
-  my ($have_c_compiler, $C_support_feature) = check_compiler();
+  my ($have_c_compiler, $C_support_feature, $tmp_exec) = check_compiler();
 
   if (! $C_support_feature) {
     plan skip_all => 'C_support not enabled';
@@ -20,6 +22,8 @@
   } else {
     plan tests => 23;
   }
+  require Cwd;
+  $tmp = MBTest->tmpdir( $tmp_exec ? undef : Cwd::cwd );
 }
 
 ensure_blib('Module::Build');
@@ -27,9 +31,6 @@
 
 #########################
 
-
-my $tmp = MBTest->tmpdir;
-
 use DistGen;
 my $dist = DistGen->new( dir => $tmp, xs => 1 );
 $dist->regen;
diff -urN perl-5.10.1.orig/lib/Module/Build.pm perl-5.10.1/lib/Module/Build.pm
--- perl-5.10.1.orig/lib/Module/Build.pm	2009-12-01 17:01:57.000000000 +0100
+++ perl-5.10.1/lib/Module/Build.pm	2009-12-01 11:51:27.000000000 +0100
@@ -15,7 +15,7 @@
 
 use vars qw($VERSION @ISA);
 @ISA = qw(Module::Build::Base);
-$VERSION = '0.340201';
+$VERSION = '0.35';
 $VERSION = eval $VERSION;
 
 # Okay, this is the brute-force method of finding out what kind of