[Bast-commits] r3954 - DBIx-Class/0.08/trunk/lib/DBIx/Class/ResultClass

matthewt at dev.catalyst.perl.org matthewt at dev.catalyst.perl.org
Fri Jan 18 13:03:09 GMT 2008


Author: matthewt
Date: 2008-01-18 13:03:08 +0000 (Fri, 18 Jan 2008)
New Revision: 3954

Modified:
   DBIx-Class/0.08/trunk/lib/DBIx/Class/ResultClass/HashRefInflator.pm
Log:
added strict and warnings to HashRefInflator, fixed inflation for empty has_many rels

Modified: DBIx-Class/0.08/trunk/lib/DBIx/Class/ResultClass/HashRefInflator.pm
===================================================================
--- DBIx-Class/0.08/trunk/lib/DBIx/Class/ResultClass/HashRefInflator.pm	2008-01-17 23:57:56 UTC (rev 3953)
+++ DBIx-Class/0.08/trunk/lib/DBIx/Class/ResultClass/HashRefInflator.pm	2008-01-18 13:03:08 UTC (rev 3954)
@@ -1,5 +1,8 @@
 package DBIx::Class::ResultClass::HashRefInflator;
 
+use strict;
+use warnings;
+
 =head1 NAME
 
 DBIx::Class::ResultClass::HashRefInflator
@@ -61,7 +64,7 @@
     # related sources.
 
     # to avoid emtpy has_many rels contain one empty hashref
-    return if (not keys %$me);
+    return undef if (not keys %$me);
 
     my $def;
 
@@ -71,13 +74,14 @@
             last;
         }
     }
-    return unless $def;
+    return undef unless $def;
 
     return { %$me,
         map {
           ( $_ =>
-             ref($rest->{$_}[0]) eq 'ARRAY' ? [ map { mk_hash(@$_) } @{$rest->{$_}} ]
-                                            : mk_hash( @{$rest->{$_}} )
+             ref($rest->{$_}[0]) eq 'ARRAY'
+                 ? [ grep defined, map mk_hash(@$_), @{$rest->{$_}} ]
+                 : mk_hash( @{$rest->{$_}} )
           )
         } keys %$rest
     };




More information about the Bast-commits mailing list