File Coverage

blib/lib/HTML/Zoom/ReadFH.pm
Criterion Covered Total %
statement 13 17 76.4
branch 2 4 50.0
condition 4 6 66.6
subroutine 3 5 60.0
pod 0 4 0.0
total 22 36 61.1


line stmt bran cond sub pod time code
1             package HTML::Zoom::ReadFH;
2              
3 14     14   59 use strictures 1;
  14         61  
  14         262  
4              
5             sub from_zoom {
6 2     2 0 2 my ($class, $zoom) = @_;
7 2         11 bless({ _zoom => $zoom }, $class)
8             }
9              
10             sub to_zoom {
11 0     0 0 0 my $self = shift;
12             # A small defense against accidental footshots. I hope.
13             # If this turns out to merely re-aim the gun at your left nipple, please
14             # come complain with a documented use case and we'll discuss deleting it.
15 0 0       0 die "Already started reading - there ain't no going back now"
16             if $self->{_stream};
17 0         0 $self->{_zoom}
18             }
19              
20             sub getline {
21 5     5 0 15 my $self = shift;
22 5         6 my $html;
23 5   66     17 my $stream = $self->{_stream} ||= $self->{_zoom}->to_stream;
24 5   66     16 my $producer = $self->{_producer} ||= $self->{_zoom}->zconfig->producer;
25 5         15 while (my ($evt) = $stream->next) {
26 32         64 $html .= $producer->event_to_html($evt);
27 32 100       82 last if $evt->{flush};
28             }
29 5         10 return $html
30             }
31              
32 0     0 0   sub close { "The door shuts behind you with a ominous boom" }
33              
34             1;