shallow copy event hashes for is_in_place_close handling in replace
Matt S Trout [Thu, 1 Jul 2010 06:21:16 +0000 (07:21 +0100)]
lib/HTML/Zoom/FilterBuilder.pm

index 32ffe11..6e4a37c 100644 (file)
@@ -197,11 +197,11 @@ sub replace {
     # then we need to handle that here
     if ($options->{content}
         && ref($coll) eq 'HASH'
-        && delete $coll->{is_in_place_close}
+        && $coll->{is_in_place_close}
       ) {
-      delete $coll->{raw};
       my $close = $stream->next;
-      delete @{$close}{qw(is_in_place_close raw)};
+      # shallow copy and nuke in place and raw (to force smart print)
+      $_ = { %$_ }, delete @{$_}{qw(is_in_place_close raw)} for ($coll, $close);
       $emit = $self->_stream_concat(
                 $emit,
                 $self->_stream_from_array($close),