4 if (@ARGV && $ARGV[0] eq '--check-version') {
6 (my $file = "$module.pm") =~ s{::}{/}g;
9 my $version = do { no strict; ${"${module}::VERSION"} };
17 my ($perl, $module) = @_;
18 my $version = `$perl $0 --check-version $module`;
20 length $version ? $version : undef;
31 my $arg = shift @ARGV;
32 if ($arg =~ /^--perl(?:=(.*))$/) {
33 push @perl, ($1 || shift @ARGV);
36 warn "unrecognized option: $arg\n";
43 [ 'ExtUtils::MakeMaker' => 6.74 ],
44 [ 'ExtUtils::Install' => 1.43 ],
45 [ 'Module::Build' => 0.36 ],
49 plan tests => @perl * (1+@modules);
51 for my $perl (@perl) {
54 local $ENV{PERL_LOCAL_LIB_ROOT};
55 local $ENV{PERL_MM_OPT};
56 local $ENV{PERL_MB_OPT};
57 delete $ENV{PERL5LIB};
58 delete $ENV{PERL_LOCAL_LIB_ROOT};
59 delete $ENV{PERL_MM_OPT};
60 delete $ENV{PERL_MB_OPT};
62 diag "testing bootstrap with $perl";
63 for my $module (@modules) {
64 my $version = check_version($perl, $module->[0]);
65 if ($version && $version >= $module->[1]) {
66 diag "Can't test bootstrap of $module->[0], version $version already meets requirement of $module->[1]";
70 $ENV{HOME} = my $home = File::Temp::tempdir( CLEANUP => 1 );
71 my $ll = File::Spec->catdir($home, 'local-lib');
73 open my $null_in, '<', File::Spec->devnull;
74 my $pid = open3 $null_in, my $out, undef, $perl, 'Makefile.PL', '--bootstrap='.$ll;
75 while (my $line = <$out>) {
80 is $?, 0, 'Makefile.PL ran successfully'
83 local::lib->setup_env_hash_for($ll);
85 for my $module (@modules) {
86 my $version = check_version($perl, $module->[0]);
87 cmp_ok $version, '>=', $module->[1], "bootstrap installed new enough $module->[0]"
88 or diag "PERL5LIB: $ENV{PERL5LIB}";