From: Florian Ragwitz Date: Wed, 1 Dec 2010 20:12:39 +0000 (+0100) Subject: Disable XS code on perls with ${^GLOBAL_PHASE} X-Git-Tag: Devel-GlobalDestruction-0.03~2 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=3790e928b4bd943715ef246f1b447190c3d162e1;p=p5sagit%2FDevel-GlobalDestruction.git Disable XS code on perls with ${^GLOBAL_PHASE} --- diff --git a/Makefile.PL b/Makefile.PL index 84887e1..7ab9cef 100644 --- a/Makefile.PL +++ b/Makefile.PL @@ -6,15 +6,16 @@ require 5.006000; use ExtUtils::MakeMaker; WriteMakefile( - NAME => 'Devel::GlobalDestruction', - VERSION_FROM => 'lib/Devel/GlobalDestruction.pm', - INSTALLDIRS => 'site', - SIGN => 1, - PL_FILES => { }, + NAME => 'Devel::GlobalDestruction', + VERSION_FROM => 'lib/Devel/GlobalDestruction.pm', + INSTALLDIRS => 'site', + SIGN => 1, + PL_FILES => { }, MIN_PERL_VERSION => '5.006000', - PREREQ_PM => { - 'Sub::Exporter' => 0, - 'Scope::Guard' => 0, - }, + PREREQ_PM => { + 'Sub::Exporter' => 0, + 'Scope::Guard' => 0, + }, + ($] >= 5.013007 ? (XS => {}, C => []) : ()), ); diff --git a/lib/Devel/GlobalDestruction.pm b/lib/Devel/GlobalDestruction.pm index b8385b7..5fe7e89 100644 --- a/lib/Devel/GlobalDestruction.pm +++ b/lib/Devel/GlobalDestruction.pm @@ -9,13 +9,18 @@ use XSLoader; our $VERSION = '0.02'; -XSLoader::load(__PACKAGE__, $VERSION); - use Sub::Exporter -setup => { exports => [ qw(in_global_destruction) ], groups => { default => [ -all ] }, }; +if ($] >= 5.013007) { + eval 'sub in_global_destruction () { ${^GLOBAL_PHASE} eq q[DESTRUCT] }'; +} +else { + XSLoader::load(__PACKAGE__, $VERSION); +} + __PACKAGE__ __END__