Author: dagolden
Date: Fri Nov 13 11:51:19 2009
New Revision: 13502

Modified:
   Module-Build/trunk/lib/inc/latest.pm
   Module-Build/trunk/t/bundle_inc.t

Log:
fix inc bundling bug

Modified: Module-Build/trunk/lib/inc/latest.pm
==============================================================================
--- Module-Build/trunk/lib/inc/latest.pm        (original)
+++ Module-Build/trunk/lib/inc/latest.pm        Fri Nov 13 11:51:19 2009
@@ -85,8 +85,11 @@
 
   # get list of files to copy
   require ExtUtils::Installed;
-  my $inst = ExtUtils::Installed->new;
-  my @files = $inst->files( $module, 'prog' );
+  # workaround buggy EU::Installed check of @INC
+  my $inst = ExtUtils::Installed->new(extra_libs => [...@inc]);
+  my $packlist = $inst->packlist( $module ) or die "Couldn't find packlist";
+  my @files = grep { /\.pm$/ } keys %$packlist;
+
 
   # figure out prefix
   my $mod_path = quotemeta $package->_mod2path( $module );

Modified: Module-Build/trunk/t/bundle_inc.t
==============================================================================
--- Module-Build/trunk/t/bundle_inc.t   (original)
+++ Module-Build/trunk/t/bundle_inc.t   Fri Nov 13 11:51:19 2009
@@ -10,11 +10,28 @@
 use ExtUtils::Packlist;
 use File::Path;
 
-plan tests => 16;
+plan tests => 17;
 
 # Ensure any Module::Build modules are loaded from correct directory
 blib_load('Module::Build');
 
+# need to do a temp install of M::B being tested to ensure a packlist
+# is available for bundling
+
+my $current_mb = Module::Build->resume();
+my $temp_install = MBTest->tmpdir();
+my $arch = $Config{archname};
+my $lib_path = File::Spec->catdir($temp_install,qw/lib perl5/);
+my $arch_path = File::Spec->catdir( $lib_path, $arch );
+mkpath ( $arch_path );
+
+unshift @INC, $lib_path, $arch_path;
+local $ENV{PERL5LIB} = join( $Config{path_sep}, 
+  $lib_path, $arch_path, ($ENV{PERL5LIB} ? $ENV{PERL5LIB} : () )
+);
+
+stdout_of( sub { $current_mb->dispatch('install', install_base => 
$temp_install) } );
+
 # create dist object in a temp directory
 # enter the directory and generate the skeleton files
 my $dist = DistGen->new( inc => 1 )->chdir_in->regen;
@@ -65,6 +82,7 @@
 stdout_of( sub { Module::Build->run_perl_script('Build.PL',[],[]) } );
 
 my $meta = IO::File->new('MYMETA.yml');
+ok( $meta, "found MYMETA.yml" );
 ok( scalar( grep { /generated_by:.*9999/ } <$meta> ),
   "dist_dir Build.PL loaded bundled Module::Build"
 );

Reply via email to