From: matthewt <matthewt@bd8105ee-0ff8-0310-8827-fb3f25b6796d>
Date: Mon, 17 Sep 2007 20:57:39 +0000 (+0000)
Subject: stupid hack to deal with CPAN.pm setting PERL5_CPANPLUS_IS_RUNNING env var
X-Git-Tag: 1.006009~96
X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=10fcef9bde685e46d711ecff94eeb3dcfbbce609;p=p5sagit%2Flocal-lib.git

stupid hack to deal with CPAN.pm setting PERL5_CPANPLUS_IS_RUNNING env var

git-svn-id: http://dev.catalyst.perl.org/repos/bast/local-lib/1.000/trunk@3756 bd8105ee-0ff8-0310-8827-fb3f25b6796d
---

diff --git a/Makefile.PL b/Makefile.PL
index 3c41873..f051476 100644
--- a/Makefile.PL
+++ b/Makefile.PL
@@ -50,6 +50,16 @@ requires 'ExtUtils::ParseXS';
 requires 'Module::Build' => '0.28'; # lib -> lib/perl5 change
 requires 'CPAN' => '1.80'; # sudo support
 
+# 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
+
+my $no_cpanplus_env = !exists $ENV{PERL5_CPANPLUS_IS_RUNNING};
+require CPAN;
+delete $ENV{PERL5_CPANPLUS_IS_RUNNING} if $no_cpanplus_env;
+
 if ($bootstrapping) {
   auto_install_now;
 } else {