| 1 |
unless (eval "use Module::Build::Compat 0.02; 1" ) { |
| 2 |
print "This module requires Module::Build to install itself.\n"; |
| 3 |
|
| 4 |
require ExtUtils::MakeMaker; |
| 5 |
my $yn = ExtUtils::MakeMaker::prompt |
| 6 |
(' Install Module::Build from CPAN?', 'y'); |
| 7 |
|
| 8 |
if ($yn =~ /^y/i) { |
| 9 |
require Cwd; |
| 10 |
require File::Spec; |
| 11 |
require CPAN; |
| 12 |
|
| 13 |
# Save this 'cause CPAN will chdir all over the place. |
| 14 |
my $cwd = Cwd::cwd(); |
| 15 |
my $makefile = File::Spec->rel2abs($0); |
| 16 |
|
| 17 |
CPAN::Shell->install('Module::Build::Compat'); |
| 18 |
|
| 19 |
chdir $cwd or die "Cannot chdir() back to $cwd: $!"; |
| 20 |
exec $^X, $makefile, @ARGV; # Redo now that we have Module::Build |
| 21 |
} else { |
| 22 |
warn " *** Cannot install without Module::Build. Exiting ...\n"; |
| 23 |
exit 1; |
| 24 |
} |
| 25 |
} |
| 26 |
Module::Build::Compat->run_build_pl(args => \@ARGV); |
| 27 |
Module::Build::Compat->write_makefile(); |