Moose taking advantage of the XS
[gitmo/Moose.git] / lib / Moose.pm
index cf44a30..b81aa74 100644 (file)
@@ -10,7 +10,6 @@ our $AUTHORITY = 'cpan:STEVAN';
 use Scalar::Util 'blessed', 'reftype';
 use Carp         'confess';
 use Sub::Name    'subname';
-use B            'svref_2object';
 
 use Sub::Exporter;
 
@@ -213,8 +212,7 @@ use Moose::Util::TypeConstraints;
                 my $keyword = \&{ $class . '::' . $name };
 
                 # make sure it is from Moose
-                my $pkg_name =
-                  eval { svref_2object($keyword)->GV->STASH->NAME };
+                my ($pkg_name) = Class::MOP::get_code_info($keyword);
                 next if $@;
                 next if $pkg_name ne 'Moose';