::Replicated - test hashref for connect_replicants and croak on coderef, switch to...
[dbsrgits/DBIx-Class.git] / lib / DBIx / Class / CDBICompat / Relationships.pm
index 0a4b475..7572870 100644 (file)
@@ -3,7 +3,7 @@ package # hide from PAUSE
 
 use strict;
 use warnings;
-
+use Sub::Name ();
 use base qw/Class::Data::Inheritable/;
 
 use Clone;
@@ -14,7 +14,7 @@ __PACKAGE__->mk_classdata('__meta_info' => {});
 
 =head1 NAME
 
-DBIx::Class::CDBICompat::Relationships
+DBIx::Class::CDBICompat::Relationships - Emulate has_a(), has_many(), might_have() and meta_info()
 
 =head1 DESCRIPTION
 
@@ -122,7 +122,8 @@ sub has_many {
     no strict 'refs';
     no warnings 'redefine';
     my $post_proc = sub { my $o = shift; $o = $o->$_ for @f_method; $o; };
-    *{"${class}::${rel}"} =
+    my $name = join '::', $class, $rel;
+    *$name = Sub::Name::subname $name,
       sub {
         my $rs = shift->search_related($rel => @_);
         $rs->{attrs}{record_filter} = $post_proc;