3 use vars qw($bootstrapping);
6 # watch out for fancy dashes. these can wind up in our @ARGV if the user is
7 # copypasting the bootstrap command from the POD displayed e.g. by perldoc
8 # on a Mac OS X terminal. since no software recognizes and handles these
9 # dashes, it's better to die loudly telling the user exactly what happened
10 # so they don't make the same mistake again rather than being the only
11 # program in the universe that works with them.
12 if(grep { /−/ } @ARGV) {
14 WHOA THERE! It looks like you've got some fancy dashes in your commandline!
15 These are *not* the traditional -- dashes that software recognizes. You
16 probably got these by copy-pasting from the perldoc for this module as
17 rendered by a UTF8-capable formatter. This most typically happens on an OS X
18 terminal, but can happen elsewhere too. Please try again after replacing the
19 dashes with normal minus signs.
22 if (my ($x) = grep { /^--bootstrap(?:=.*)?$/ } @ARGV) {
23 @ARGV = grep { !/^--bootstrap(?:=.*)?$/ } @ARGV;
25 $x =~ /^--bootstrap(?:=(.*))?$/;
26 my @args = (defined $1 ? ($1) : ());
34 local::lib->import(@args);
36 push(@ARGV,$ENV{PERL_MM_OPT});
37 push(@ARGV, map { "-I$_" } split(':',$ENV{PERL5LIB}));
39 system($^X, '-MExtUtils::MakeMaker 6.31', '-e1');
42 system($^X, '-MCPAN 1.80', '-e1');
44 my $cpan_command = '';
46 system($^X, '-MCPAN', '-e',
47 'my $done; require ExtUtils::MakeMaker;
48 my $orig = ExtUtils::MakeMaker->can("prompt");
49 *ExtUtils::MakeMaker::prompt = sub {
50 if (!$done && $_[0] =~ /manual configuration/) {
57 unless ($done || -w $CPAN::Config->{keep_source_where}) {
58 my $save = $CPAN::Config->{urllist};
59 delete @{$CPAN::Config}{keys %$CPAN::Config};
60 $CPAN::Config->{urllist} = $save;
65 $ENV{PERL_MM_USE_DEFAULT} = 1;
67 # XXX - remove the force on EUMM once its test suite survive PERL_MM_OPT
69 if ($eumm) { # non-zero exit
70 $cpan_command .= 'force("install","ExtUtils::MakeMaker"); ';
73 $cpan_command .= 'force("install","CPAN"); ';
75 if(length $cpan_command) {
76 system($^X, '-MCPAN', '-e', $cpan_command);
79 system($^X, '-MCPAN', '-e', 'CPAN::Config->load; CPAN::Config->commit;');
84 use inc::Module::Install;
87 all_from 'lib/local/lib.pm';
89 requires 'ExtUtils::MakeMaker' => '6.31'; # version INSTALL_BASE was added
90 requires 'ExtUtils::CBuilder'; # this and ParseXS are needed for MB C_support
91 requires 'ExtUtils::ParseXS';
92 requires 'Module::Build' => '0.28'; # lib -> lib/perl5 change
93 requires 'CPAN' => '1.80'; # sudo support
96 # https://rt.cpan.org/Public/Bug/Display.html?id=23735
97 # for why CPAN now sets the CPANPLUS env var.
98 # trouble is this means we can't auto_install(_now) CPAN itself
99 # without this beautiful hack
101 my $no_cpanplus_env = !exists $ENV{PERL5_CPANPLUS_IS_RUNNING};
103 delete $ENV{PERL5_CPANPLUS_IS_RUNNING} if $no_cpanplus_env;
105 if ($bootstrapping) {