X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FDBIx%2FClass%2FResultSet.pm;h=427657a994f8d60eb52e0d05073d60a9fbc488c1;hb=c7d50a7de2182fbfe933fa15b8015cb026f10c54;hp=db6c27e88a9e700d6cc057ed136ab4551b9d5482;hpb=bac358c9d99a75db2d2bab8f11102ed557f523b7;p=dbsrgits%2FDBIx-Class-Historic.git diff --git a/lib/DBIx/Class/ResultSet.pm b/lib/DBIx/Class/ResultSet.pm index db6c27e..427657a 100644 --- a/lib/DBIx/Class/ResultSet.pm +++ b/lib/DBIx/Class/ResultSet.pm @@ -271,15 +271,22 @@ sub search { my $self = shift; my $rs = $self->search_rs( @_ ); - my $want = wantarray; - if ($want) { + if (wantarray) { return $rs->all; } - elsif (defined $want) { + elsif (defined wantarray) { return $rs; } else { - $self->throw_exception ('->search is *not* a mutator, calling it in void context makes no sense'); + # we can be called by a relationship helper, which in + # turn may be called in void context due to some braindead + # overload or whatever else the user decided to be clever + # at this particular day. Thus limit the exception to + # external code calls only + $self->throw_exception ('->search is *not* a mutator, calling it in void context makes no sense') + if (caller)[0] !~ /^\QDBIx::Class::/; + + return (); } }