+sub HTML::Element::hash_map {
+ my $container = shift;
+
+ my %p = validate(@_, {
+ hash => { type => HASHREF },
+ to_attr => 1,
+ excluding => { type => ARRAYREF , default => [] },
+ debug => { default => 0 },
+ });
+
+ warn 'The container tag is ', $container->tag if $p{debug} ;
+ warn 'hash' . Dumper($p{hash}) if $p{debug} ;
+ warn 'at_under' . Dumper(\@_);
+
+ my @same_as = $container->look_down( $p{to_attr} => qr/.+/ ) ;
+
+ warn 'Found ' . scalar(@same_as) . ' nodes' if $p{debug} ;
+
+
+ for my $same_as (@same_as) {
+ my $attr_val = $same_as->attr($p{to_attr}) ;
+ if (first { $attr_val eq $_ } @{$p{excluding}}) {
+ warn "excluding $attr_val" if $p{debug} ;
+ next;
+ }
+ warn "processing $attr_val" if $p{debug} ;
+ $same_as->replace_content( $p{hash}->{$attr_val} ) ;
+ }
+
+}
+
+
+sub HTML::Element::passover {
+ my ($tree, $child_id) = @_;
+
+ warn "ARGS: my ($tree, $child_id)" if $DEBUG;
+ warn $tree->as_HTML(undef, ' ') if $DEBUG;
+
+ my $exodus = $tree->look_down(id => $child_id);
+
+ warn "E: $exodus" if $DEBUG;
+
+ my @s = HTML::Element::siblings($exodus);
+
+ for my $s (@s) {
+ next unless ref $s;
+ if ($s->attr('id') eq $child_id) {
+ ;
+ } else {
+ $s->delete;
+ }
+ }
+
+ return $exodus; # Goodbye Egypt! http://en.wikipedia.org/wiki/Passover
+
+}
+