Stop needlesly invoking the $rs bool overload
Peter Rabbitson [Mon, 18 Mar 2013 06:27:51 +0000 (07:27 +0100)]
lib/DBIx/Class/Relationship/Base.pm
lib/DBIx/Class/ResultSet.pm

index 6dcfc67..cd9749f 100644 (file)
@@ -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'" );
index 89ec655..d6e54e3 100644 (file)
@@ -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);