line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package HTML::Zoom::StreamBase; |
2
|
|
|
|
|
|
|
|
3
|
15
|
|
|
15
|
|
94
|
use strictures 1; |
|
15
|
|
|
|
|
128
|
|
|
15
|
|
|
|
|
341
|
|
4
|
15
|
|
|
15
|
|
9377
|
use HTML::Zoom::TransformBuilder; |
|
15
|
|
|
|
|
40
|
|
|
15
|
|
|
|
|
13791
|
|
5
|
|
|
|
|
|
|
|
6
|
203
|
|
|
203
|
|
1230
|
sub _zconfig { shift->{_zconfig} } |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
sub peek { |
9
|
570
|
|
|
570
|
0
|
794
|
my ($self) = @_; |
10
|
570
|
100
|
|
|
|
1230
|
if (exists $self->{_peeked}) { |
11
|
2
|
|
|
|
|
11
|
return ($self->{_peeked}); |
12
|
|
|
|
|
|
|
} |
13
|
568
|
100
|
|
|
|
1695
|
if (my ($peeked) = $self->_next(1)) { |
14
|
564
|
|
|
|
|
2710
|
return ($self->{_peeked} = $peeked); |
15
|
|
|
|
|
|
|
} |
16
|
4
|
|
|
|
|
26
|
return; |
17
|
|
|
|
|
|
|
} |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
sub next { |
20
|
6114
|
|
|
6114
|
0
|
7619
|
my ($self) = @_; |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
# peeked entry so return that |
23
|
|
|
|
|
|
|
|
24
|
6114
|
100
|
|
|
|
13620
|
if (exists $self->{_peeked}) { |
25
|
560
|
100
|
|
|
|
1748
|
if (my $peeked_from = delete $self->{_peeked_from}) { |
26
|
209
|
|
|
|
|
387
|
$peeked_from->next; |
27
|
|
|
|
|
|
|
} |
28
|
560
|
|
|
|
|
1678
|
return (delete $self->{_peeked}); |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
|
31
|
5554
|
|
|
|
|
14955
|
$self->_next; |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
sub flatten { |
36
|
131
|
|
|
131
|
0
|
193
|
my $self = shift; |
37
|
131
|
|
|
|
|
13289
|
require HTML::Zoom::FlattenedStream; |
38
|
131
|
|
|
|
|
408
|
HTML::Zoom::FlattenedStream->new({ |
39
|
|
|
|
|
|
|
source => $self, |
40
|
|
|
|
|
|
|
zconfig => $self->_zconfig |
41
|
|
|
|
|
|
|
}); |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
sub map { |
45
|
18
|
|
|
18
|
0
|
38
|
my ($self, $mapper) = @_; |
46
|
18
|
|
|
|
|
5717
|
require HTML::Zoom::MappedStream; |
47
|
18
|
|
|
|
|
114
|
HTML::Zoom::MappedStream->new({ |
48
|
|
|
|
|
|
|
source => $self, mapper => $mapper, zconfig => $self->_zconfig |
49
|
|
|
|
|
|
|
}); |
50
|
|
|
|
|
|
|
} |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
sub with_filter { |
53
|
0
|
|
|
0
|
0
|
0
|
my ($self, $selector, $filter) = @_; |
54
|
0
|
|
|
|
|
0
|
my $match = $self->_parse_selector($selector); |
55
|
0
|
|
|
|
|
0
|
$self->_zconfig->stream_utils->wrap_with_filter($self, $match, $filter); |
56
|
|
|
|
|
|
|
} |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
sub with_transform { |
59
|
54
|
|
|
54
|
0
|
76
|
my ($self, $transform) = @_; |
60
|
54
|
|
|
|
|
207
|
$transform->apply_to_stream($self); |
61
|
|
|
|
|
|
|
} |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
sub select { |
64
|
54
|
|
|
54
|
0
|
193
|
my ($self, $selector) = @_; |
65
|
54
|
|
|
|
|
138
|
return HTML::Zoom::TransformBuilder->new({ |
66
|
|
|
|
|
|
|
zconfig => $self->_zconfig, |
67
|
|
|
|
|
|
|
selector => $selector, |
68
|
|
|
|
|
|
|
filters => [], |
69
|
|
|
|
|
|
|
proto => $self, |
70
|
|
|
|
|
|
|
}); |
71
|
|
|
|
|
|
|
} |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
sub then { |
74
|
6
|
|
|
6
|
0
|
8
|
my ($self) = @_; |
75
|
|
|
|
|
|
|
# see notes in HTML/Zoom.pm for why this needs to be fixed |
76
|
6
|
|
|
|
|
18
|
$self->select($self->transform->selector); |
77
|
|
|
|
|
|
|
} |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
sub apply { |
80
|
0
|
|
|
0
|
0
|
0
|
my ($self, $code) = @_; |
81
|
0
|
|
|
|
|
0
|
local $_ = $self; |
82
|
0
|
|
|
|
|
0
|
$self->$code; |
83
|
|
|
|
|
|
|
} |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
sub apply_if { |
86
|
0
|
|
|
0
|
0
|
0
|
my ($self, $predicate, $code) = @_; |
87
|
0
|
0
|
|
|
|
0
|
if($predicate) { |
88
|
0
|
|
|
|
|
0
|
local $_ = $self; |
89
|
0
|
|
|
|
|
0
|
$self->$code; |
90
|
|
|
|
|
|
|
} |
91
|
|
|
|
|
|
|
else { |
92
|
0
|
|
|
|
|
0
|
$self; |
93
|
|
|
|
|
|
|
} |
94
|
|
|
|
|
|
|
} |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
sub to_html { |
97
|
0
|
|
|
0
|
0
|
0
|
my ($self) = @_; |
98
|
0
|
|
|
|
|
0
|
$self->_zconfig->producer->html_from_stream($self); |
99
|
|
|
|
|
|
|
} |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
sub AUTOLOAD { |
102
|
8
|
|
|
8
|
|
52
|
my ($self, $selector, @args) = @_; |
103
|
8
|
|
|
|
|
13
|
my $meth = our $AUTOLOAD; |
104
|
8
|
|
|
|
|
37
|
$meth =~ s/.*:://; |
105
|
8
|
|
|
|
|
33
|
return $self = $self->select($selector)->$meth(@args); |
106
|
|
|
|
|
|
|
} |
107
|
|
|
|
|
|
|
|
108
|
0
|
|
|
0
|
|
|
sub DESTROY {} |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
1; |