[Bps-public-commit] r15807 - in Data-Hierarchy/trunk: .

clkao at bestpractical.com clkao at bestpractical.com
Mon Sep 8 06:59:39 EDT 2008


Author: clkao
Date: Mon Sep  8 06:59:39 2008
New Revision: 15807

Modified:
   Data-Hierarchy/trunk/   (props changed)
   Data-Hierarchy/trunk/Hierarchy.pm
   Data-Hierarchy/trunk/t/1basic.t
   Data-Hierarchy/trunk/t/2basic-with-sep.t
   Data-Hierarchy/trunk/t/3store-vs-store_recursively.t

Log:
 r35416 at mtl (orig r351):  glasser | 2006-07-26 02:47:19 +0800
  r44551 at 30-6-186:  glasser | 2006-07-25 14:39:38 -0400
  Have store's keyword arguments be in a hashref.
 


Modified: Data-Hierarchy/trunk/Hierarchy.pm
==============================================================================
--- Data-Hierarchy/trunk/Hierarchy.pm	(original)
+++ Data-Hierarchy/trunk/Hierarchy.pm	Mon Sep  8 06:59:39 2008
@@ -23,7 +23,7 @@
     my @items = $tree->find ('/', {access => qr/.*/});
 
     # override all children
-    $tree->store ('/', {'.note' => undef}, override_sticky_descendents => 1);
+    $tree->store ('/', {'.note' => undef}, {override_sticky_descendents => 1});
 
 =head1 DESCRIPTION
 
@@ -100,7 +100,7 @@
 
 =cut
 
-=item C<store $path, $properties, %options>
+=item C<store $path, $properties, {%options}>
 
 Given a path and a hash reference of properties, stores the properties
 at the path.
@@ -142,13 +142,14 @@
     my $self = shift;
     my $path = shift;
     my $props = shift;
+    my $opts = shift || {};
 
     $self->_path_safe ($path);
 
     my %args = (
                override_descendents => 1,
                override_sticky_descendents => 0,
-                @_);
+                %$opts);
 
     $self->_remove_matching_properties_recursively($path, $props, $self->{hash})
       if $args{override_descendents};

Modified: Data-Hierarchy/trunk/t/1basic.t
==============================================================================
--- Data-Hierarchy/trunk/t/1basic.t	(original)
+++ Data-Hierarchy/trunk/t/1basic.t	Mon Sep  8 06:59:39 2008
@@ -57,7 +57,7 @@
                                                    otherinfo => 'fnord',
                                                    '.sticky' => 'this is private fnord' });
 
-$tree->store ('/', {access => 'all', type => 'null'}, override_sticky_descendents => 1);
+$tree->store ('/', {access => 'all', type => 'null'}, {override_sticky_descendents => 1});
 
 # Tree is:
 # / [access: all, type: null]
@@ -70,7 +70,7 @@
 
 my $tree2 = Data::Hierarchy->new();
 $tree2->store ('/private/blah', {access => 'no', type => 'pam', giggle => 'haha'});
-$tree2->store ('/private', {access => 'auth', type => 'pam', blah => 'fnord'}, override_sticky_descendents => 1);
+$tree2->store ('/private', {access => 'auth', type => 'pam', blah => 'fnord'}, {override_sticky_descendents => 1});
 
 # Tree2 is:
 # /private [access: auth, type: pam, blah: fnord]

Modified: Data-Hierarchy/trunk/t/2basic-with-sep.t
==============================================================================
--- Data-Hierarchy/trunk/t/2basic-with-sep.t	(original)
+++ Data-Hierarchy/trunk/t/2basic-with-sep.t	Mon Sep  8 06:59:39 2008
@@ -57,7 +57,7 @@
                                                      otherinfo => 'fnord',
                                                      '.sticky' => 'this is private fnord' });
 
-$tree->store ('\\', {access => 'all', type => 'null'}, override_sticky_descendents => 1);
+$tree->store ('\\', {access => 'all', type => 'null'}, {override_sticky_descendents => 1});
 
 # Tree is:
 # / [access: all, type: null]
@@ -70,7 +70,7 @@
 
 my $tree2 = Data::Hierarchy->new(sep => '\\');
 $tree2->store ('\\private\\blah', {access => 'no', type => 'pam', giggle => 'haha'});
-$tree2->store ('\\private', {access => 'auth', type => 'pam', blah => 'fnord'}, override_sticky_descendents => 1);
+$tree2->store ('\\private', {access => 'auth', type => 'pam', blah => 'fnord'}, {override_sticky_descendents => 1});
 
 # Tree2 is:
 # /private [access: auth, type: pam, blah: fnord]

Modified: Data-Hierarchy/trunk/t/3store-vs-store_recursively.t
==============================================================================
--- Data-Hierarchy/trunk/t/3store-vs-store_recursively.t	(original)
+++ Data-Hierarchy/trunk/t/3store-vs-store_recursively.t	Mon Sep  8 06:59:39 2008
@@ -48,25 +48,25 @@
   [{a => 1, '.k' => 20}, '/foo'];
 
 reset_tree();
-$TREE->store('/foo', {a => 1}, override_sticky_descendents => 1);
+$TREE->store('/foo', {a => 1}, {override_sticky_descendents => 1});
 test_foo_and_bar
   [{a => 1, '.k' => 10}, '/foo'],
   [{a => 1, '.k' => 20}, '/foo'];
 
 reset_tree();
-$TREE->store('/foo', {a => 3}, override_sticky_descendents => 1);
+$TREE->store('/foo', {a => 3}, {override_sticky_descendents => 1});
 test_foo_and_bar
   [{a => 3, '.k' => 10}, '/foo'],
   [{a => 3, '.k' => 20}, '/foo'];
 
 reset_tree();
-$TREE->store('/foo', {a => 1}, override_descendents => 0);
+$TREE->store('/foo', {a => 1}, {override_descendents => 0});
 test_foo_and_bar
   [{a => 1, '.k' => 10}, '/foo'],
   [{a => 2, '.k' => 20}, '/foo', '/foo/bar'];
 
 reset_tree();
-$TREE->store('/foo', {a => 3}, override_descendents => 0);
+$TREE->store('/foo', {a => 3}, {override_descendents => 0});
 test_foo_and_bar
   [{a => 3, '.k' => 10}, '/foo'],
   [{a => 2, '.k' => 20}, '/foo', '/foo/bar'];
@@ -78,13 +78,13 @@
   [{'.k' => 20}];
 
 reset_tree();
-$TREE->store('/foo', {a => undef}, override_descendents => 0);
+$TREE->store('/foo', {a => undef}, {override_descendents => 0});
 test_foo_and_bar
   [{'.k' => 10}],
   [{a => 2, '.k' => 20}, '/foo/bar'];
 
 reset_tree();
-$TREE->store('/foo', {a => undef}, override_sticky_descendents => 1);
+$TREE->store('/foo', {a => undef}, {override_sticky_descendents => 1});
 test_foo_and_bar
   [{'.k' => 10}],
   [{'.k' => 20}];
@@ -104,25 +104,25 @@
   [{a => 2, '.k' => 20}, '/foo', '/foo/bar'];
 
 reset_tree();
-$TREE->store('/foo', {'.k' => 10}, override_sticky_descendents => 1);
+$TREE->store('/foo', {'.k' => 10}, {override_sticky_descendents => 1});
 test_foo_and_bar
   [{a => 1, '.k' => 10}, '/foo'],
   [{a => 2}, '/foo', '/foo/bar'];
 
 reset_tree();
-$TREE->store('/foo', {'.k' => 30}, override_sticky_descendents => 1);
+$TREE->store('/foo', {'.k' => 30}, {override_sticky_descendents => 1});
 test_foo_and_bar
   [{a => 1, '.k' => 30}, '/foo'],
   [{a => 2}, '/foo', '/foo/bar'];
 
 reset_tree();
-$TREE->store('/foo', {'.k' => 10}, override_descendents => 0);
+$TREE->store('/foo', {'.k' => 10}, {override_descendents => 0});
 test_foo_and_bar
   [{a => 1, '.k' => 10}, '/foo'],
   [{a => 2, '.k' => 20}, '/foo', '/foo/bar'];
 
 reset_tree();
-$TREE->store('/foo', {'.k' => 30}, override_descendents => 0);
+$TREE->store('/foo', {'.k' => 30}, {override_descendents => 0});
 test_foo_and_bar
   [{a => 1, '.k' => 30}, '/foo'],
   [{a => 2, '.k' => 20}, '/foo', '/foo/bar'];
@@ -135,13 +135,13 @@
   [{a => 2, '.k' => 20}, '/foo', '/foo/bar'];
 
 reset_tree();
-$TREE->store('/foo', {'.k' => undef}, override_sticky_descendents => 1);
+$TREE->store('/foo', {'.k' => undef}, {override_sticky_descendents => 1});
 test_foo_and_bar
   [{a => 1}, '/foo'],
   [{a => 2}, '/foo', '/foo/bar'];
 
 reset_tree();
-$TREE->store('/foo', {'.k' => undef}, override_descendents => 0);
+$TREE->store('/foo', {'.k' => undef}, {override_descendents => 0});
 test_foo_and_bar
   [{a => 1}, '/foo'],
   [{a => 2, '.k' => 20}, '/foo', '/foo/bar'];
@@ -169,37 +169,37 @@
   [{a => 3, '.k' => 20}, '/foo', '/foo/bar'];
 
 reset_tree();
-$TREE->store('/foo/bar', {a => 2}, override_descendents => 0);
+$TREE->store('/foo/bar', {a => 2}, {override_descendents => 0});
 test_foo_and_bar
   [{a => 1, '.k' => 10}, '/foo'],
   [{a => 2, '.k' => 20}, '/foo', '/foo/bar'];
 
 reset_tree();
-$TREE->store('/foo/bar', {a => 1}, override_descendents => 0);
+$TREE->store('/foo/bar', {a => 1}, {override_descendents => 0});
 test_foo_and_bar
   [{a => 1, '.k' => 10}, '/foo'],
   [{a => 1, '.k' => 20}, '/foo'];
 
 reset_tree();
-$TREE->store('/foo/bar', {a => 3}, override_descendents => 0);
+$TREE->store('/foo/bar', {a => 3}, {override_descendents => 0});
 test_foo_and_bar
   [{a => 1, '.k' => 10}, '/foo'],
   [{a => 3, '.k' => 20}, '/foo', '/foo/bar'];
 
 reset_tree();
-$TREE->store('/foo/bar', {a => 2}, override_sticky_descendents => 1);
+$TREE->store('/foo/bar', {a => 2}, {override_sticky_descendents => 1});
 test_foo_and_bar
   [{a => 1, '.k' => 10}, '/foo'],
   [{a => 2, '.k' => 20}, '/foo', '/foo/bar'];
 
 reset_tree();
-$TREE->store('/foo/bar', {a => 1}, override_sticky_descendents => 1);
+$TREE->store('/foo/bar', {a => 1}, {override_sticky_descendents => 1});
 test_foo_and_bar
   [{a => 1, '.k' => 10}, '/foo'],
   [{a => 1, '.k' => 20}, '/foo'];
 
 reset_tree();
-$TREE->store('/foo/bar', {a => 3}, override_sticky_descendents => 1);
+$TREE->store('/foo/bar', {a => 3}, {override_sticky_descendents => 1});
 test_foo_and_bar
   [{a => 1, '.k' => 10}, '/foo'],
   [{a => 3, '.k' => 20}, '/foo', '/foo/bar'];



More information about the Bps-public-commit mailing list