line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package TAP::Parser::Iterator::Stream; |
2
|
|
|
|
|
|
|
|
3
|
33
|
|
|
33
|
|
120
|
use strict; |
|
33
|
|
|
|
|
44
|
|
|
33
|
|
|
|
|
777
|
|
4
|
33
|
|
|
33
|
|
110
|
use warnings; |
|
33
|
|
|
|
|
44
|
|
|
33
|
|
|
|
|
716
|
|
5
|
|
|
|
|
|
|
|
6
|
33
|
|
|
33
|
|
160
|
use base 'TAP::Parser::Iterator'; |
|
33
|
|
|
|
|
34
|
|
|
33
|
|
|
|
|
7347
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
=head1 NAME |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
TAP::Parser::Iterator::Stream - Iterator for filehandle-based TAP sources |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
=head1 VERSION |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
Version 3.39 |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
=cut |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
our $VERSION = '3.39'; |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
=head1 SYNOPSIS |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
use TAP::Parser::Iterator::Stream; |
23
|
|
|
|
|
|
|
open( TEST, 'test.tap' ); |
24
|
|
|
|
|
|
|
my $it = TAP::Parser::Iterator::Stream->new(\*TEST); |
25
|
|
|
|
|
|
|
my $line = $it->next; |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
=head1 DESCRIPTION |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
This is a simple iterator wrapper for reading from filehandles, used by |
30
|
|
|
|
|
|
|
L. Unless you're writing a plugin or subclassing, you probably |
31
|
|
|
|
|
|
|
won't need to use this module directly. |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
=head1 METHODS |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
=head2 Class Methods |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
=head3 C |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
Create an iterator. Expects one argument containing a filehandle. |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
=cut |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
# new() implementation supplied by TAP::Object |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
sub _initialize { |
46
|
13
|
|
|
13
|
|
27
|
my ( $self, $thing ) = @_; |
47
|
13
|
|
|
|
|
88
|
$self->{fh} = $thing; |
48
|
13
|
|
|
|
|
38
|
return $self; |
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
=head2 Instance Methods |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
=head3 C |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
Iterate through it, of course. |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
=head3 C |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
Iterate raw input without applying any fixes for quirky input syntax. |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
=head3 C |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
Get the wait status for this iterator. Always returns zero. |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
=head3 C |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
Get the exit status for this iterator. Always returns zero. |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
=cut |
70
|
|
|
|
|
|
|
|
71
|
8
|
|
|
8
|
1
|
22
|
sub wait { shift->exit } |
72
|
17
|
100
|
|
17
|
1
|
1244
|
sub exit { shift->{fh} ? () : 0 } |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
sub next_raw { |
75
|
49
|
|
|
49
|
1
|
56
|
my $self = shift; |
76
|
49
|
|
|
|
|
68
|
my $fh = $self->{fh}; |
77
|
|
|
|
|
|
|
|
78
|
49
|
100
|
|
|
|
436
|
if ( defined( my $line = <$fh> ) ) { |
79
|
38
|
|
|
|
|
63
|
chomp $line; |
80
|
38
|
|
|
|
|
114
|
return $line; |
81
|
|
|
|
|
|
|
} |
82
|
|
|
|
|
|
|
else { |
83
|
11
|
|
|
|
|
36
|
$self->_finish; |
84
|
11
|
|
|
|
|
42
|
return; |
85
|
|
|
|
|
|
|
} |
86
|
|
|
|
|
|
|
} |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
sub _finish { |
89
|
11
|
|
|
11
|
|
20
|
my $self = shift; |
90
|
11
|
|
|
|
|
180
|
close delete $self->{fh}; |
91
|
|
|
|
|
|
|
} |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
1; |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
=head1 ATTRIBUTION |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
Originally ripped off from L. |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
=head1 SEE ALSO |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
L, |
102
|
|
|
|
|
|
|
L, |
103
|
|
|
|
|
|
|
L, |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
=cut |
106
|
|
|
|
|
|
|
|