From: Peter Rabbitson Date: Wed, 11 Feb 2009 10:37:36 +0000 (+0000) Subject: make single() die if passed attributes X-Git-Tag: v0.08240~134 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=0a0585ddc73e571741e98d51446d83083ed1e4f1;p=dbsrgits%2FDBIx-Class.git make single() die if passed attributes --- diff --git a/lib/DBIx/Class/ResultSet.pm b/lib/DBIx/Class/ResultSet.pm index 565a17d..1610eb1 100644 --- a/lib/DBIx/Class/ResultSet.pm +++ b/lib/DBIx/Class/ResultSet.pm @@ -607,6 +607,10 @@ of the resultset. sub single { my ($self, $where) = @_; + if(@_ > 2) { + $self->throw_exception('single() only takes search conditions, no attributes. You want ->search( $cond, $attrs )->single()'); + } + my $attrs = { %{$self->_resolved_attrs} }; if ($where) { if (defined $attrs->{where}) {