my $z2 = $z1->select('div')->replace_content('I AM A DIV!');
-Returns an intermediary object of the class L<HTML::Zoom::MatchWithoutFilter>
+Returns an intermediary object of the class L<HTML::Zoom::TransformBuilder>
on which methods of your L<HTML::Zoom::FilterBuilder> object can be called.
In normal usage you should generally always put the pair of method calls
+++ /dev/null
-package HTML::Zoom::MatchWithoutFilter;
-
-use strict;
-use warnings FATAL => 'all';
-
-sub construct {
- bless({
- zoom => $_[1], match => $_[2], fb => $_[3],
- }, $_[0]);
-}
-
-sub DESTROY {}
-
-sub AUTOLOAD {
- my $meth = our $AUTOLOAD;
- $meth =~ s/.*:://;
- my $self = shift;
- if (my $cr = $self->{fb}->can($meth)) {
- return $self->{zoom}->with_filter(
- $self->{match}, $self->{fb}->$cr(@_)
- );
- }
- die "Filter builder ${\$self->{fb}} does not provide action ${meth}";
-}
-
-1;
use strict;
use warnings FATAL => 'all';
-use HTML::Zoom::MatchWithoutFilter;
+use HTML::Zoom::TransformBuilder;
sub _zconfig { shift->{_zconfig} }
$self->_zconfig->stream_utils->wrap_with_filter($self, $match, $filter);
}
-sub select {
- my ($self, $selector) = @_;
- my $match = $self->_parse_selector($selector);
- return HTML::Zoom::MatchWithoutFilter->construct(
- $self, $match, $self->_zconfig->filter_builder,
- );
+sub with_transform {
+ my ($self, $transform) = @_;
+ $transform->apply_to_stream($self);
}
-sub _parse_selector {
+sub select {
my ($self, $selector) = @_;
- return $selector if ref($selector); # already a match sub
- $self->_zconfig->selector_parser->parse_selector($selector);
+ return HTML::Zoom::TransformBuilder->new({
+ zconfig => $self->_zconfig,
+ selector => $selector,
+ filters => [],
+ proto => $self,
+ });
}
sub apply {