[Dbix-class] Patch submission: Relationship Accessor for null pattern compatibility

David Ihnen davidi at norchemlab.com
Wed Mar 11 00:24:07 GMT 2009


When working with the null pattern classes from Mr. Rabbitson, I 
discovered this slight ommission that results in getting an undefined, 
when you're actually wanting a null.  That is, even when something is 
not true, I still want it!  It should be entirely backwards compatible 
with existing code.  Perhaps it can it make it into the next version?

Hopefully,

David



--- /usr/share/perl5/DBIx/Class/Relationship/Accessor.pm    2009-03-10 
17:19:39.000000000 -0700
+++ DBIx/Class/Relationship/Accessor.pm    2009-03-10 17:13:52.000000000 
-0700
@@ -25,7 +25,7 @@
         return $self->{_relationship_data}{$rel};
       } else {
         my $val = $self->find_related($rel, {}, {});
-        return unless $val;
+        return $val unless $val;
         return $self->{_relationship_data}{$rel} = $val;
       }
     };







More information about the DBIx-Class mailing list