[Bps-public-commit] r15806 - Data-Hierarchy/trunk

clkao at bestpractical.com clkao at bestpractical.com
Mon Sep 8 06:58:08 EDT 2008


Author: clkao
Date: Mon Sep  8 06:58:08 2008
New Revision: 15806

Modified:
   Data-Hierarchy/trunk/   (props changed)
   Data-Hierarchy/trunk/Hierarchy.pm

Log:
 r35415 at mtl (orig r350):  glasser | 2006-07-26 02:47:16 +0800
  r44550 at 30-6-186:  glasser | 2006-07-25 14:35:37 -0400
  Only do cleanup once on merges.
 


Modified: Data-Hierarchy/trunk/Hierarchy.pm
==============================================================================
--- Data-Hierarchy/trunk/Hierarchy.pm	(original)
+++ Data-Hierarchy/trunk/Hierarchy.pm	Mon Sep  8 06:58:08 2008
@@ -128,6 +128,18 @@
 
 sub store {
     my $self = shift;
+    $self->_store_no_cleanup(@_);
+    $self->_remove_redundant_properties_and_undefs;
+}
+
+# Internal method.
+#
+# Does everything that store does, except for the cleanup at the
+# end (appropriate for use in e.g. merge, which calls this a bunch of
+# times and then does cleanup at the end).
+
+sub _store_no_cleanup {
+    my $self = shift;
     my $path = shift;
     my $props = shift;
 
@@ -233,8 +245,10 @@
 	    $other_props->{$_} = undef
 		unless defined $other_props->{$_};
 	}
-	$self->store ($datapoint, $other_props);
+	$self->_store_no_cleanup ($datapoint, $other_props);
     }
+
+    $self->_remove_redundant_properties_and_undefs;
 }
 
 =item C<to_relative $base_path>
@@ -292,7 +306,6 @@
 # Internal method.
 #
 # Actually does property updates (to hash or sticky, depending on name).
-# Calls _remove_redundant_properties_and_undefs at the end.
 
 sub _store {
     my ($self, $path, $new_props) = @_;
@@ -313,8 +326,6 @@
     }
 
     $self->{hash}{$path} = $merged_props;
-
-    $self->_remove_redundant_properties_and_undefs;
 }
 
 # Internal method.



More information about the Bps-public-commit mailing list