From: Matt S Trout Date: Wed, 17 Feb 2010 21:43:43 +0000 (+0000) Subject: change collect to empty its into argument at the start of the collect process and... X-Git-Tag: release_0.009004~83 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FHTML-Zoom.git;a=commitdiff_plain;h=b4d044eb69c61bc8265e79ab5190b9d9795937e1 change collect to empty its into argument at the start of the collect process and comment why --- diff --git a/lib/HTML/Zoom/FilterBuilder.pm b/lib/HTML/Zoom/FilterBuilder.pm index 823ebf6..64b85b2 100644 --- a/lib/HTML/Zoom/FilterBuilder.pm +++ b/lib/HTML/Zoom/FilterBuilder.pm @@ -85,7 +85,13 @@ sub collect { my ($into, $passthrough, $inside) = @{$options}{qw(into passthrough inside)}; sub { my ($evt, $stream) = @_; - push(@$into, $evt) if $into && !$inside; + # We wipe the contents of @$into here so that other actions depending + # on this (such as a repeater) can be invoked multiple times easily. + # I -suspect- it's better for that state reset to be managed here; if it + # ever becomes painful the decision should be revisited + if ($into) { + @$into = $inside ? () : ($evt); + } if ($evt->{is_in_place_close}) { return $evt if $passthrough || $inside; return;