diff Lib/IMPL/DOM/Transform/ObjectToDOM.pm @ 257:299af584c05f

collapse empty array elements in POSTed data
author sergey
date Fri, 14 Dec 2012 03:07:41 +0400
parents 129e48bb5afb
children 0f59b2de72af
line wrap: on
line diff
--- a/Lib/IMPL/DOM/Transform/ObjectToDOM.pm	Wed Dec 12 04:29:50 2012 +0400
+++ b/Lib/IMPL/DOM/Transform/ObjectToDOM.pm	Fri Dec 14 03:07:41 2012 +0400
@@ -79,7 +79,8 @@
         my $value = $data->{$key};
         
         if (ref $value eq 'ARRAY') {
-            foreach my $subval (@$value) {
+            #TODO: collapse empty values only if needed
+            foreach my $subval (grep $_, @$value) {
                 
                 $this->_navi->saveState();
                 
@@ -109,8 +110,6 @@
             
             $this->_navi->applyState();
             
-            warn "$key = $value";
-            
             $this->Transform($value);
             
             $this->_navi->Back();            
@@ -126,8 +125,6 @@
     
     $node->nodeValue($data);
     
-    warn "Stored value for", $node->nodeName;
-    
     return $node;
 }