new content_handler functionality
authortbrannon <tbrannon@devel.cybertechnologyllc.com>
Tue, 13 Jan 2009 16:31:23 +0000 (11:31 -0500)
committertbrannon <tbrannon@devel.cybertechnologyllc.com>
Tue, 13 Jan 2009 16:31:23 +0000 (11:31 -0500)
lib/HTML/Element/Library.pm

index 08f6ee5cf0fa293fd3203880f37938e9cfbde61a..99abc3d39f7c534ce6eff10ac7cbba1cbedcbbeb 100644 (file)
@@ -39,7 +39,7 @@ sub HTML::Element::siblings {
 sub HTML::Element::passover {
   my ($tree, $child_id) = @_;
   
-  #warn "ARGS:   my ($tree, $child)";
+  warn "ARGS:   my ($tree, $child_id)";
 
   my $exodus = $tree->look_down(id => $child_id);
 
@@ -111,9 +111,12 @@ sub HTML::Element::position {
 
 
 sub HTML::Element::content_handler {
-  my ($tree, $id_name, $content) = @_;
+  my ($tree, %content_hash) = @_;
+
+  for my $k (keys %content_hash) {
+      $tree->set_child_content(id => $k, $content_hash{$k});      
+  }
 
-  $tree->set_child_content(id => $id_name, $content);
 
 }
 
@@ -737,7 +740,7 @@ happens to be a non-element, a push_content is performed instead.
 
 After finding the node, it detaches the node's content and pushes $content as the node's content.
 
-=head3 $tree->content_handler($sid_value , $content)
+=head3 $tree->content_handler(%id_content)
 
 This is a convenience method. Because the look_down criteria will often simply be:
 
@@ -755,6 +758,15 @@ Instead of typing:
 
   $elem->set_child_content(sid => 'fixme', 'new text') 
 
+PLEASE NOTE: you can pass a hash whose keys are C<id>s and whose values are the content you want there and it will perform the replacement on each hash member:
+
+  my %id_content = (name => "Terrence Brannon",      
+                    email => 'tbrannon@in.com',
+                    balance => 666,                         
+                    content => $main_content);             
+
+  $tree->content_handler(%id_content);  
+
 =head3 $tree->highlander($subtree_span_id, $conditionals, @conditionals_args)
 
 This allows for "if-then-else" style processing. Highlander was a movie in
This page took 0.010974 seconds and 4 git commands to generate.