Make ->add_after("foo") etc. from HTML::Zoom::FilterBuilder work
Unfortunately fixing ->add_before("foo") is not that easy.
sub add_before {
my ($self, $events) = @_;
sub { return $self->$self->_stream_from_proto($events), $_[0]) };
}
doesn't work, as it dies with the following error message
Can't call method "next" on unblessed reference
at HTML-Zoom/lib/HTML/Zoom/FlattenedStream.pm line 17.
The following does work, but is overly complicated; there should be
easier way to do this:
sub add_before {
my ($self, $events) = @_;
my $emit = $self->_stream_from_proto($events);
my @evts = $self->_zconfig->stream_utils->stream_to_array($emit);
sub { return $self->_stream_from_array(@evts, $_[0]) };
}