use base 'Class::C3::Componentised';
use mro 'c3';
+use DBIx::Class::_Util 'get_subname';
use DBIx::Class::Carp '^DBIx::Class|^Class::C3::Componentised';
use namespace::clean;
or next;
if ($sc ne $base_store_column) {
- require B;
- my $definer = B::svref_2object($sc)->STASH->NAME;
+ my ($definer) = get_subname($sc);
push @broken, ($definer eq $existing_comp)
? $existing_comp
: "$existing_comp (via $definer)"
our @EXPORT_OK = qw(
sigwarn_silencer modver_gt_or_eq modver_gt_or_eq_and_lt
fail_on_internal_wantarray fail_on_internal_call
- refdesc refcount hrefaddr set_subname describe_class_methods
+ refdesc refcount hrefaddr set_subname get_subname describe_class_methods
scope_guard detected_reinvoked_destructor emit_loud_diag
true false
is_exception dbic_internal_try visit_namespaces
$visited_count;
}
-# FIXME In another life switch this to a polyfill like the one in namespace::clean
+# FIXME In another life switch these to a polyfill like the ones in namespace::clean
+sub get_subname ($) {
+ my $gv = B::svref_2object( $_[0] )->GV;
+ wantarray
+ ? ( $gv->STASH->NAME, $gv->NAME )
+ : ( join '::', $gv->STASH->NAME, $gv->NAME )
+ ;
+}
sub set_subname ($$) {
# fully qualify name
use DBICTest;
use File::Find;
use File::Spec;
-use B qw/svref_2object/;
+use DBIx::Class::_Util 'get_subname';
# makes sure we can load at least something
use DBIx::Class;
# overload is a funky thing - it is not cleaned, and its imports are named funny
next if $name =~ /^\(/;
- my $gv = svref_2object($all_method_like{$name})->GV;
- my $origin = $gv->STASH->NAME;
+ my ($origin, $cv_name) = get_subname($all_method_like{$name});
- is ($gv->NAME, $name, "Properly named $name method at $origin" . ($origin eq $mod
+ is ($cv_name, $name, "Properly named $name method at $origin" . ($origin eq $mod
? ''
: " (inherited by $mod)"
));
- next if $seen->{"${origin}:${name}"}++;
+ next if $seen->{"${origin}::${name}"}++;
if ($origin eq $mod) {
pass ("$name is a native $mod method");