[Bast-commits] r5734 -
DBIx-Class/0.08/trunk/lib/DBIx/Class/Relationship
ribasushi at dev.catalyst.perl.org
ribasushi at dev.catalyst.perl.org
Wed Mar 11 09:43:40 GMT 2009
Author: ribasushi
Date: 2009-03-11 09:43:40 +0000 (Wed, 11 Mar 2009)
New Revision: 5734
Modified:
DBIx-Class/0.08/trunk/lib/DBIx/Class/Relationship/Accessor.pm
Log:
Allow accessors type single to return defined but false objects (needed for null-pattern style components)
Modified: DBIx-Class/0.08/trunk/lib/DBIx/Class/Relationship/Accessor.pm
===================================================================
--- DBIx-Class/0.08/trunk/lib/DBIx/Class/Relationship/Accessor.pm 2009-03-11 06:57:05 UTC (rev 5733)
+++ DBIx-Class/0.08/trunk/lib/DBIx/Class/Relationship/Accessor.pm 2009-03-11 09:43:40 UTC (rev 5734)
@@ -35,7 +35,14 @@
return if grep { not defined } values %$cond;
}
my $val = $self->find_related($rel, {}, {});
- return unless $val;
+
+ # this really should have been:
+ # return $val unless $val
+ # however someone might already be relying on return() as in:
+ # my @things = map { $_->might_have_acc } ($rs->all)
+ # thus keeping the quirky behavior
+ return unless defined $val;
+
return $self->{_relationship_data}{$rel} = $val;
}
};
More information about the Bast-commits
mailing list