Commit | Line | Data |
8a1c87d1 |
1 | package HTML::Zoom::FlattenedStream; |
2 | |
1cf03540 |
3 | use strictures 1; |
8a1c87d1 |
4 | use base qw(HTML::Zoom::StreamBase); |
5 | |
6 | sub new { |
7 | my ($class, $args) = @_; |
8 | bless({ _source => $args->{source}, _zconfig => $args->{zconfig} }, $class); |
9 | } |
10 | |
b5a48c47 |
11 | sub _next { |
12 | |
8a1c87d1 |
13 | return unless (my $self = shift)->{_source}; |
14 | my ($next, $s); |
15 | until (($next) = ($s = $self->{_cur}) ? $s->next : ()) { |
16 | unless (($self->{_cur}) = $self->{_source}->next) { |
17 | delete $self->{_source}; return; |
18 | } |
19 | } |
20 | return $next; |
21 | } |
22 | |
23 | 1; |