feature check rather than version check
[p5sagit/Devel-GlobalDestruction.git] / lib / Devel / GlobalDestruction.pm
index d242727..04efbba 100644 (file)
@@ -5,26 +5,22 @@ package Devel::GlobalDestruction;
 use strict;
 use warnings;
 
-use vars qw($VERSION @ISA);
+use XSLoader;
 
-BEGIN {
-       $VERSION = '0.02';
-
-
-       if ( do { local $@; eval { require XSLoader; 1 } } ) {
-               __PACKAGE__->XSLoader::load($VERSION);
-       } else {
-               require DynaLoader;
-               push @ISA, 'DynaLoader';
-               __PACKAGE__->bootstrap($VERSION);
-       }
-}
+our $VERSION = '0.03';
 
 use Sub::Exporter -setup => {
        exports => [ qw(in_global_destruction) ],
        groups  => { default => [ -all ] },
 };
 
+if (defined ${^GLOBAL_PHASE}) {
+    eval 'sub in_global_destruction () { ${^GLOBAL_PHASE} eq q[DESTRUCT] }';
+}
+else {
+    XSLoader::load(__PACKAGE__, $VERSION);
+}
+
 __PACKAGE__
 
 __END__
@@ -79,10 +75,12 @@ This module is maintained using Darcs. You can get the latest version from
 L<http://nothingmuch.woobling.org/code>, and use C<darcs send> to commit
 changes.
 
-=head1 AUTHOR
+=head1 AUTHORS
 
 Yuval Kogman E<lt>nothingmuch@woobling.orgE<gt>
 
+Florian Ragwitz E<lt>rafl@debian.orgE<gt>
+
 =head1 COPYRIGHT
 
        Copyright (c) 2008 Yuval Kogman. All rights reserved