From: Peter Rabbitson Date: Mon, 18 Mar 2013 06:27:51 +0000 (+0100) Subject: Stop needlesly invoking the $rs bool overload X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=3d0733aac1d6b24f71d0836ff3418ea8cdeba97a;p=dbsrgits%2FDBIx-Class-Historic.git Stop needlesly invoking the $rs bool overload --- diff --git a/lib/DBIx/Class/Relationship/Base.pm b/lib/DBIx/Class/Relationship/Base.pm index 6dcfc67..cd9749f 100644 --- a/lib/DBIx/Class/Relationship/Base.pm +++ b/lib/DBIx/Class/Relationship/Base.pm @@ -447,7 +447,10 @@ sub related_resultset { my $rel = shift; - return $self->{related_resultsets}{$rel} ||= do { + return $self->{related_resultsets}{$rel} + if defined $self->{related_resultsets}{$rel}; + + return $self->{related_resultsets}{$rel} = do { my $rel_info = $self->relationship_info($rel) or $self->throw_exception( "No such relationship '$rel'" ); diff --git a/lib/DBIx/Class/ResultSet.pm b/lib/DBIx/Class/ResultSet.pm index 89ec655..d6e54e3 100644 --- a/lib/DBIx/Class/ResultSet.pm +++ b/lib/DBIx/Class/ResultSet.pm @@ -3085,7 +3085,10 @@ Returns a related resultset for the supplied relationship name. sub related_resultset { my ($self, $rel) = @_; - return $self->{related_resultsets}{$rel} ||= do { + return $self->{related_resultsets}{$rel} + if defined $self->{related_resultsets}{$rel}; + + return $self->{related_resultsets}{$rel} = do { my $rsrc = $self->result_source; my $rel_info = $rsrc->relationship_info($rel);