X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FDBIx%2FClass%2FRelationship%2FManyToMany.pm;h=387fc0b4f1622b4853bc3067f6fb4d0f3c1ffde8;hb=0b88a5bb24f2b536a11ea76e228897f60a10893d;hp=f01cc107e1fe660d14517252c57081a29f1a3565;hpb=78af1010e7fb71c50d441fb0f86dcc9b77ee3ac2;p=dbsrgits%2FDBIx-Class-Historic.git diff --git a/lib/DBIx/Class/Relationship/ManyToMany.pm b/lib/DBIx/Class/Relationship/ManyToMany.pm index f01cc10..387fc0b 100644 --- a/lib/DBIx/Class/Relationship/ManyToMany.pm +++ b/lib/DBIx/Class/Relationship/ManyToMany.pm @@ -1,18 +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,$cond,$attrs) = @_; - $self->search_related($rel)->search_related($f_rel, $cond, { %$rel_attrs, %{$attrs||{}} }); + my $self = shift; + my $attrs = @_ > 1 && ref $_[$#_] eq 'HASH' ? pop(@_) : {}; + $self->search_related($rel)->search_related($f_rel, @_ > 0 ? @_ : undef, { %{$rel_attrs||{}}, %$attrs }); }; } }