use Scalar::Util 'blessed', 'reftype';
use Carp 'confess';
use Sub::Name 'subname';
-use B 'svref_2object';
use Sub::Exporter;
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';