factor out ArrayStream, update new stream types to respect peek
[catagits/HTML-Zoom.git] / lib / HTML / Zoom / FilterStream.pm
index 641144f..a0bc6b7 100644 (file)
@@ -11,30 +11,14 @@ sub new {
       _stream => $args->{stream},
       _match => $args->{match},
       _filter => $args->{filter},
+      _zconfig => $args->{zconfig},
     },
     $class
   );
 }
 
-sub peek {
+sub _next {
   my ($self) = @_;
-  if (exists $self->{_peeked}) {
-    return ($self->{_peeked});
-  }
-  if (my ($peeked) = $self->next) {
-    return ($self->{_peeked} = $peeked);
-  }
-  return;
-}
-
-sub next {
-  my ($self) = @_;
-
-  # peeked entry so return that
-
-  if (exists $self->{_peeked}) {
-    return (delete $self->{_peeked});
-  }
 
   # if our main stream is already gone then we can short-circuit
   # straight out - there's no way for an alternate stream to be there