1 package # hide from PAUSE
2 DBIx::Class::CDBICompat::HasMany;
8 my ($class, $rel, $f_class, $f_key, $args) = @_;
12 if (ref $f_class eq 'ARRAY') {
13 ($f_class, @f_method) = @$f_class;
16 if (ref $f_key eq 'HASH' && !$args) { $args = $f_key; undef $f_key; };
19 if (delete $args->{no_cascade_delete}) {
20 $args->{cascade_delete} = 0;
23 $class->next::method($rel, $f_class, $f_key, $args);
27 no warnings 'redefine';
28 my $post_proc = sub { my $o = shift; $o = $o->$_ for @f_method; $o; };
29 *{"${class}::${rel}"} =
31 my $rs = shift->search_related($rel => @_);
32 $rs->{attrs}{record_filter} = $post_proc;
33 return (wantarray ? $rs->all : $rs);