From: Dave Rolsky Date: Wed, 3 Sep 2008 17:01:26 +0000 (+0000) Subject: Tie together loading our XS plus our XS deps, so we only have _two_ X-Git-Tag: 0.66~11 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=3ecd1b253d51e4159c5dd0387cfe84bde55a3f43;p=gitmo%2FClass-MOP.git Tie together loading our XS plus our XS deps, so we only have _two_ effective versions of MOP, as opposed to, uh, a bunch more (math is hard). --- diff --git a/lib/Class/MOP.pm b/lib/Class/MOP.pm index becce3e..70d8a39 100644 --- a/lib/Class/MOP.pm +++ b/lib/Class/MOP.pm @@ -11,24 +11,6 @@ use MRO::Compat; use Carp 'confess'; use Scalar::Util 'weaken'; -BEGIN { - local $@; - eval { - require Sub::Name; - Sub::Name->import(qw(subname)); - 1 - } or eval 'sub subname { $_[1] }'; - - # this is either part of core or set up appropriately by MRO::Compat - *check_package_cache_flag = \&mro::get_pkg_gen; - - eval { - require Devel::GlobalDestruction; - Devel::GlobalDestruction->import("in_global_destruction"); - 1; - } or *in_global_destruction = sub () { !1 }; -} - use Class::MOP::Class; use Class::MOP::Attribute; @@ -44,6 +26,9 @@ BEGIN { *HAVE_ISAREV = defined(&mro::get_isarev) ? sub () { 1 } : sub () { 1 }; + + # this is either part of core or set up appropriately by MRO::Compat + *check_package_cache_flag = \&mro::get_pkg_gen; } our $VERSION = '0.65'; @@ -66,6 +51,12 @@ sub _try_load_xs { # for some reason local $^W = 0; __PACKAGE__->XSLoader::load($XS_VERSION); + + require Sub::Name; + Sub::Name->import(qw(subname)); + + require Devel::GlobalDestruction; + Devel::GlobalDestruction->import("in_global_destruction"); }; $@; }; @@ -78,6 +69,9 @@ sub _try_load_xs { sub _load_pure_perl { require Sub::Identify; Sub::Identify->import('get_code_info'); + + *subname = sub { $_[1] }; + *in_global_destruction = sub () { !1 } }