line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package TAP::Parser::Iterator::Stream; |
2
|
|
|
|
|
|
|
|
3
|
33
|
|
|
33
|
|
122
|
use strict; |
|
33
|
|
|
|
|
40
|
|
|
33
|
|
|
|
|
739
|
|
4
|
33
|
|
|
33
|
|
110
|
use warnings; |
|
33
|
|
|
|
|
37
|
|
|
33
|
|
|
|
|
727
|
|
5
|
|
|
|
|
|
|
|
6
|
33
|
|
|
33
|
|
119
|
use base 'TAP::Parser::Iterator'; |
|
33
|
|
|
|
|
39
|
|
|
33
|
|
|
|
|
7060
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
=head1 NAME |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
TAP::Parser::Iterator::Stream - Iterator for filehandle-based TAP sources |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
=head1 VERSION |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
Version 3.38 |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
=cut |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
our $VERSION = '3.38'; |
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
|
|
25
|
my ( $self, $thing ) = @_; |
47
|
13
|
|
|
|
|
56
|
$self->{fh} = $thing; |
48
|
13
|
|
|
|
|
37
|
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
|
17
|
sub wait { shift->exit } |
72
|
17
|
100
|
|
17
|
1
|
1224
|
sub exit { shift->{fh} ? () : 0 } |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
sub next_raw { |
75
|
49
|
|
|
49
|
1
|
48
|
my $self = shift; |
76
|
49
|
|
|
|
|
61
|
my $fh = $self->{fh}; |
77
|
|
|
|
|
|
|
|
78
|
49
|
100
|
|
|
|
328
|
if ( defined( my $line = <$fh> ) ) { |
79
|
38
|
|
|
|
|
56
|
chomp $line; |
80
|
38
|
|
|
|
|
104
|
return $line; |
81
|
|
|
|
|
|
|
} |
82
|
|
|
|
|
|
|
else { |
83
|
11
|
|
|
|
|
33
|
$self->_finish; |
84
|
11
|
|
|
|
|
36
|
return; |
85
|
|
|
|
|
|
|
} |
86
|
|
|
|
|
|
|
} |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
sub _finish { |
89
|
11
|
|
|
11
|
|
18
|
my $self = shift; |
90
|
11
|
|
|
|
|
109
|
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
|
|
|
|
|
|
|
|