typo fix
[p5sagit/Devel-GlobalDestruction.git] / Makefile.PL
index ee99c6a..ceb9563 100644 (file)
@@ -19,6 +19,15 @@ BEGIN { if ( $^O eq 'cygwin' ) {
   }
 }}
 
+my $pureperl;
+for my $i (0..$#ARGV) {
+  if ($ARGV[$i] =~ /^PUREPERL_ONLY=(.*)/) {
+    $pureperl = $1;
+    splice @ARGV, $i, 1;
+    last;
+  }
+}
+
 my $mymeta_works = eval { ExtUtils::MakeMaker->VERSION('6.5707'); 1 };
 my $mymeta = $mymeta_works || eval { ExtUtils::MakeMaker->VERSION('6.5702'); 1 };
 
@@ -26,7 +35,7 @@ my %META_BITS = (
 );
 my %RUN_DEPS = (
   'Sub::Exporter::Progressive' => '0.001006',
-  ( (defined ${^GLOBAL_PHASE} or !can_xs() )
+  ( (defined ${^GLOBAL_PHASE} or $pureperl or !can_xs() )
     ? ()
     : ('Devel::GlobalDestruction::XS' => 0)
   ),
@@ -65,6 +74,21 @@ unless ( eval { ExtUtils::MakeMaker->VERSION('6.56') } ) {
   }
 }
 
+if (eval { require Devel::GlobalDestruction }
+    && Devel::GlobalDestruction->VERSION < 0.10) {
+  package MY;
+  no warnings 'once';
+
+  *install = sub {
+    my $self = shift;
+    return '
+pure_site_install ::
+       $(NOECHO) $(RM_F) ' . $self->quote_literal(
+      $self->catfile('$(DESTINSTALLSITEARCH)', 'Devel', 'GlobalDestruction.pm')
+    ) . "\n" . $self->SUPER::install;
+  };
+}
+
 delete $WriteMakefileArgs{CONFIGURE_REQUIRES}
   unless eval { ExtUtils::MakeMaker->VERSION('6.52') };