X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FDBIx%2FClass%2FRelationship%2FManyToMany.pm;h=387fc0b4f1622b4853bc3067f6fb4d0f3c1ffde8;hb=89279e9d0fff6fe2b90d0e3624c0349403c724f7;hp=0ecc9150357ada5c7657dcb9a6c571ec8063cba9;hpb=0f6ac8bbd6575d44fcb30cefcb5e387bb09d8b79;p=dbsrgits%2FDBIx-Class-Historic.git diff --git a/lib/DBIx/Class/Relationship/ManyToMany.pm b/lib/DBIx/Class/Relationship/ManyToMany.pm index 0ecc915..387fc0b 100644 --- a/lib/DBIx/Class/Relationship/ManyToMany.pm +++ b/lib/DBIx/Class/Relationship/ManyToMany.pm @@ -1,19 +1,18 @@ -package DBIx::Class::Relationship::ManyToMany; +package # hide from PAUSE + DBIx::Class::Relationship::ManyToMany; use strict; use warnings; sub many_to_many { my ($class, $meth, $rel, $f_rel, $rel_attrs) = @_; - $rel_attrs ||= {}; - { no strict 'refs'; no warnings 'redefine'; *{"${class}::${meth}"} = sub { my $self = shift; my $attrs = @_ > 1 && ref $_[$#_] eq 'HASH' ? pop(@_) : {}; - $self->search_related($rel)->search_related($f_rel, @_ > 0 ? @_ : undef, { %$rel_attrs, %$attrs }); + $self->search_related($rel)->search_related($f_rel, @_ > 0 ? @_ : undef, { %{$rel_attrs||{}}, %$attrs }); }; } }