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

clkao at bestpractical.com clkao at bestpractical.com
Mon Sep 8 06:55:50 EDT 2008


Author: clkao
Date: Mon Sep  8 06:55:50 2008
New Revision: 15803

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

Log:
 r35304 at mtl (orig r239):  clkao | 2004-11-10 22:51:39 +0800
 Data::Hierarchy 0.21.
 
 


Modified: Data-Hierarchy/trunk/CHANGES
==============================================================================
--- Data-Hierarchy/trunk/CHANGES	(original)
+++ Data-Hierarchy/trunk/CHANGES	Mon Sep  8 06:55:50 2008
@@ -1,3 +1,8 @@
+[Changes for 0.21 - Nov 10, 2004]
+
+* fix store_recursively for empty key, which should find
+  all descendents. [Autrijus]
+
 [Changes for 0.20 - Sep 18, 2004]
 
 * Make store_fast faster.

Modified: Data-Hierarchy/trunk/Hierarchy.pm
==============================================================================
--- Data-Hierarchy/trunk/Hierarchy.pm	(original)
+++ Data-Hierarchy/trunk/Hierarchy.pm	Mon Sep  8 06:55:50 2008
@@ -1,5 +1,5 @@
 package Data::Hierarchy;
-$VERSION = '0.20';
+$VERSION = '0.21';
 use strict;
 use Clone qw(clone);
 
@@ -47,9 +47,10 @@
 }
 
 sub key_safe {
-    use Carp;
-    confess 'key unsafe'
-	if length ($_[1]) > 1 and rindex($_[1], $_[0]->{sep}) == length ($_[1]);
+    if (length ($_[1]) > 1 and rindex($_[1], $_[0]->{sep}) == length ($_[1])) {
+	require Carp;
+	Carp::confess('key unsafe');
+    }
     $_[1] =~ s/\Q$_[0]->{sep}\E+$//;
 }
 
@@ -100,13 +101,16 @@
 
 sub _descendents {
     my ($self, $hash, $key) = @_;
+
+    # If finding for everything, don't bother grepping
+    return sort keys %$hash unless length($key);
+
     return sort grep {index($_.$self->{sep}, $key.$self->{sep}) == 0}
 	keys %$hash;
 }
 
 sub descendents {
     my ($self, $key) = @_;
-    use Carp;
     my $both = {%{$self->{hash}}, %{$self->{sticky} || {}}};
 
     # If finding for everything, don't bother grepping

Modified: Data-Hierarchy/trunk/META.yml
==============================================================================
--- Data-Hierarchy/trunk/META.yml	(original)
+++ Data-Hierarchy/trunk/META.yml	Mon Sep  8 06:55:50 2008
@@ -1,7 +1,7 @@
 # http://module-build.sourceforge.net/META-spec.html
 #XXXXXXX This is a prototype!!!  It will change in the future!!! XXXXX#
 name:         Data-Hierarchy
-version:      0.20
+version:      0.21
 version_from: Hierarchy.pm
 installdirs:  site
 requires:



More information about the Bps-public-commit mailing list