X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FDBIx%2FClass%2FRelationship%2FManyToMany.pm;h=efbd770b74f506e4a92a33781d8780b35d1e951d;hb=aeb1bf757122d5260a1d84f17f2d0beec7822165;hp=0ecc9150357ada5c7657dcb9a6c571ec8063cba9;hpb=0f6ac8bbd6575d44fcb30cefcb5e387bb09d8b79;p=dbsrgits%2FDBIx-Class.git diff --git a/lib/DBIx/Class/Relationship/ManyToMany.pm b/lib/DBIx/Class/Relationship/ManyToMany.pm index 0ecc915..efbd770 100644 --- a/lib/DBIx/Class/Relationship/ManyToMany.pm +++ b/lib/DBIx/Class/Relationship/ManyToMany.pm @@ -5,15 +5,13 @@ 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 }); }; } }