Author: dagolden
Date: Thu Dec 17 11:49:22 2009
New Revision: 13676
Modified:
Module-Build/trunk/Changes
Module-Build/trunk/lib/inc/latest.pm
Module-Build/trunk/t/bundle_inc.t
Log:
fix inc::latest guts for older Perls
Modified: Module-Build/trunk/Changes
==============================================================================
--- Module-Build/trunk/Changes (original)
+++ Module-Build/trunk/Changes Thu Dec 17 11:49:22 2009
@@ -13,7 +13,9 @@
- 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
Modified: Module-Build/trunk/lib/inc/latest.pm
==============================================================================
--- Module-Build/trunk/lib/inc/latest.pm (original)
+++ Module-Build/trunk/lib/inc/latest.pm Thu Dec 17 11:49:22 2009
@@ -21,16 +21,12 @@
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
Modified: Module-Build/trunk/t/bundle_inc.t
==============================================================================
--- Module-Build/trunk/t/bundle_inc.t (original)
+++ Module-Build/trunk/t/bundle_inc.t Thu Dec 17 11:49:22 2009
@@ -22,7 +22,7 @@
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 @@
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 @@
"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 @@
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"
);