Permalink
Browse files

fix inc::latest guts for older Perls

git-svn-id: http://svn.perl.org/modules/Module-Build/trunk@13676 50811bd7-b8ce-0310-adc1-d9db26280581
  • Loading branch information...
1 parent bbe47d9 commit ea8d5bb9b1f44daf98001cc86e23ae7b28af45dc @xdg xdg committed Dec 17, 2009
Showing with 13 additions and 14 deletions.
  1. +3 −1 Changes
  2. +4 −8 lib/inc/latest.pm
  3. +6 −5 t/bundle_inc.t
View
@@ -13,7 +13,9 @@ Revision history for Perl extension Module::Build.
- Change t/00-compile.t test for more portability
- - Skip ppm.t if Pod::HTML is not available
+ - Skip ppm.t if Pod::Html is not available
+
+ - Changed guts inc::latest to work properly on older versions of Perl
- Ensure bundle_inc.t doesn't accidentally uninstall the installed M::B
during testing if the user had 'uninst=1' set during Build.PL
View
@@ -21,16 +21,12 @@ sub import {
my ($package, $mod, @args) = @_;
return unless(defined $mod);
- my $inc_path = './inc/latest.pm';
- my $private_path = './inc/latest/private.pm';
+ my $inc_path = 'inc/latest.pm';
+ my $private_path = 'inc/latest/private.pm';
if(-e $inc_path) {
- # delete our methods
- delete $inc::latest::{$_} for(keys %inc::latest::);
- # load the bundled module
- require $inc_path;
require $private_path;
- my $import = inc::latest->can('import');
- goto $import;
+ splice( @_, 0, 1, 'inc::latest::private');
+ goto \&inc::latest::private::import;
}
# author mode - just record and load the modules
View
@@ -22,7 +22,7 @@ elsif ( ! MBTest::check_EUI() ) {
plan skip_all => 'ExtUtils::Installed takes too long on your system';
}
elsif ( Module::Build::ConfigData->feature('inc_bundling_support') ) {
- plan tests => 18;
+ plan tests => 19;
} else {
plan skip_all => 'inc_bundling_support feature is not enabled';
}
@@ -40,7 +40,7 @@ ok( -d $arch_path, "created temporary M::B pseudo-install directory");
unshift @INC, $lib_path, $arch_path;
local $ENV{PERL5LIB} = join( $Config{path_sep},
- $lib_path, $arch_path, ($ENV{PERL5LIB} ? $ENV{PERL5LIB} : () )
+ $lib_path, ($ENV{PERL5LIB} ? $ENV{PERL5LIB} : () )
);
# must uninst=0 so we don't try to remove an installed M::B!
@@ -62,12 +62,12 @@ is_deeply( $mb->bundle_inc, [ 'Module::Build' ],
"Module::Build is flagged for bundling"
);
-# see what gets bundled
+# bundle stuff into distdir
stdout_stderr_of( sub { $mb->dispatch('distdir') } );
my $dist_inc = File::Spec->catdir($mb->dist_dir, 'inc');
ok( -e File::Spec->catfile( $dist_inc, 'latest.pm' ),
- "./inc/latest.pm created"
+ "dist_dir/inc/latest.pm created"
);
ok( -d File::Spec->catdir( $dist_inc, 'inc_Module-Build' ),
@@ -111,9 +111,10 @@ SKIP: {
chdir $mb->dist_dir;
stdout_of( sub { Module::Build->run_perl_script('Build.PL',[],[]) } );
+ ok( -e 'MYMETA.yml', 'MYMETA was created' );
my $meta = IO::File->new('MYMETA.yml');
- ok( $meta, "found MYMETA.yml" );
+ ok( $meta, "opened MYMETA.yml" );
ok( scalar( grep { /generated_by:.*9999/ } <$meta> ),
"dist_dir Build.PL loaded bundled Module::Build"
);

0 comments on commit ea8d5bb

Please sign in to comment.