X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=dbsrgits%2FDBIx-Class.git;a=blobdiff_plain;f=lib%2FDBIx%2FClass%2FResultSet.pm;h=c6a68c3a9846761065895402c1751a4f6450ff9c;hp=474b5da7d6a871888b91f0e3cfb05bd4205dba80;hb=0e7a447e570daf41c11b403fd81046756894cc27;hpb=a85b7ebe9762ca64a08468f6c8f27a0ae583d38c diff --git a/lib/DBIx/Class/ResultSet.pm b/lib/DBIx/Class/ResultSet.pm index 474b5da..c6a68c3 100644 --- a/lib/DBIx/Class/ResultSet.pm +++ b/lib/DBIx/Class/ResultSet.pm @@ -249,7 +249,17 @@ For more help on using joins with search, see L. sub search { my $self = shift; my $rs = $self->search_rs( @_ ); - return (wantarray ? $rs->all : $rs); + + my $want = wantarray; + if ($want) { + return $rs->all; + } + elsif (defined $want) { + return $rs; + } + else { + $self->throw_exception ('->search is *not* a mutator, calling it in void context makes no sense'); + } } =head2 search_rs