From: Tatsuhiko Miyagawa Date: Sun, 21 Mar 2010 13:30:31 +0000 (-0700) Subject: don't bother fixing CPAN if running from cpanminus (RT#85731) X-Git-Tag: 1.008011~2 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=ca889d4211d335291d7fc76f8d058b8138d5b8ea;p=p5sagit%2Flocal-lib.git don't bother fixing CPAN if running from cpanminus (RT#85731) --- diff --git a/Makefile.PL b/Makefile.PL index d067451..9632385 100644 --- a/Makefile.PL +++ b/Makefile.PL @@ -183,24 +183,26 @@ all_from 'lib/local/lib.pm'; requires 'ExtUtils::MakeMaker' => '6.31'; # version INSTALL_BASE was added requires 'ExtUtils::Install' => '1.43'; # ditto requires 'Module::Build' => '0.36'; # PERL_MB_OPT -my $required_CPAN = '1.82'; -requires 'CPAN' => $required_CPAN; # sudo support + CPAN::HandleConfig -# No, really. See -# https://rt.cpan.org/Public/Bug/Display.html?id=23735 -# for why CPAN now sets the CPANPLUS env var. -# trouble is this means we can't auto_install(_now) CPAN itself -# without this beautiful hack +# don't bother fixing CPAN.pm if bootstrapped from cpanminus +unless ($ENV{PERL5_CPANM_IS_RUNNING}) { + my $required_CPAN = '1.82'; + requires 'CPAN' => $required_CPAN; # sudo support + CPAN::HandleConfig -my $no_cpanplus_env = !exists $ENV{PERL5_CPANPLUS_IS_RUNNING}; -my $no_cpan_env = !exists $ENV{PERL5_CPAN_IS_RUNNING}; -require CPAN; -delete $ENV{PERL5_CPANPLUS_IS_RUNNING} if $no_cpanplus_env; -delete $ENV{PERL5_CPAN_IS_RUNNING} if $no_cpan_env; + # No, really. See + # https://rt.cpan.org/Public/Bug/Display.html?id=23735 + # for why CPAN now sets the CPANPLUS env var. + # trouble is this means we can't auto_install(_now) CPAN itself + # without this beautiful hack -# and make sure that the user doesn't have any existing CPAN config that'll -# cause us problems for the next few steps. -{ + my $no_cpanplus_env = !exists $ENV{PERL5_CPANPLUS_IS_RUNNING}; + my $no_cpan_env = !exists $ENV{PERL5_CPAN_IS_RUNNING}; + require CPAN; + delete $ENV{PERL5_CPANPLUS_IS_RUNNING} if $no_cpanplus_env; + delete $ENV{PERL5_CPAN_IS_RUNNING} if $no_cpan_env; + + # and make sure that the user doesn't have any existing CPAN config that'll + # cause us problems for the next few steps. local $@; eval { require CPAN::HandleConfig; }; # Need newish CPAN.pm for this, ergo skip it if that version of CPAN isn't