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   78 use strictures 1;
  14         71  
  14         345  
4              
5             sub from_zoom {
6 2     2 0 3 my ($class, $zoom) = @_;
7 2         10 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 27 my $self = shift;
22 5         6 my $html;
23 5   66     31 my $stream = $self->{_stream} ||= $self->{_zoom}->to_stream;
24 5   66     22 my $producer = $self->{_producer} ||= $self->{_zoom}->zconfig->producer;
25 5         103 while (my ($evt) = $stream->next) {
26 32         93 $html .= $producer->event_to_html($evt);
27 32 100       138 last if $evt->{flush};
28             }
29 5         15 return $html
30             }
31              
32 0     0 0   sub close { "The door shuts behind you with a ominous boom" }
33              
34             1;