fix thinkos in ResultSet docs
[dbsrgits/DBIx-Class-Historic.git] / lib / DBIx / Class / Relationship / ManyToMany.pm
index f01cc10..0ecc915 100644 (file)
@@ -11,8 +11,9 @@ sub many_to_many {
     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 });
     };
   }
 }