line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package TAP::Parser::Iterator::Array; |
2
|
|
|
|
|
|
|
|
3
|
33
|
|
|
33
|
|
246
|
use strict; |
|
33
|
|
|
|
|
95
|
|
|
33
|
|
|
|
|
1188
|
|
4
|
33
|
|
|
33
|
|
263
|
use warnings; |
|
33
|
|
|
|
|
89
|
|
|
33
|
|
|
|
|
1150
|
|
5
|
|
|
|
|
|
|
|
6
|
33
|
|
|
33
|
|
217
|
use base 'TAP::Parser::Iterator'; |
|
33
|
|
|
|
|
95
|
|
|
33
|
|
|
|
|
9670
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
=head1 NAME |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
TAP::Parser::Iterator::Array - Iterator for array-based TAP sources |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
=head1 VERSION |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
Version 3.40_01 |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
=cut |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
our $VERSION = '3.40_01'; |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
=head1 SYNOPSIS |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
use TAP::Parser::Iterator::Array; |
23
|
|
|
|
|
|
|
my @data = ('foo', 'bar', baz'); |
24
|
|
|
|
|
|
|
my $it = TAP::Parser::Iterator::Array->new(\@data); |
25
|
|
|
|
|
|
|
my $line = $it->next; |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
=head1 DESCRIPTION |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
This is a simple iterator wrapper for arrays of scalar content, 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. Takes one argument: an C<$array_ref> |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
=head2 Instance Methods |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
=head3 C |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
Iterate through it, of course. |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
=head3 C |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
Iterate raw input without applying any fixes for quirky input syntax. |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
=head3 C |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
Get the wait status for this iterator. For an array iterator this will always |
54
|
|
|
|
|
|
|
be zero. |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
=head3 C |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
Get the exit status for this iterator. For an array iterator this will always |
59
|
|
|
|
|
|
|
be zero. |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
=cut |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
# new() implementation supplied by TAP::Object |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
sub _initialize { |
66
|
81
|
|
|
81
|
|
248
|
my ( $self, $thing ) = @_; |
67
|
81
|
|
|
|
|
320
|
chomp @$thing; |
68
|
81
|
|
|
|
|
400
|
$self->{idx} = 0; |
69
|
81
|
|
|
|
|
250
|
$self->{array} = $thing; |
70
|
81
|
|
|
|
|
242
|
$self->{exit} = undef; |
71
|
81
|
|
|
|
|
377
|
return $self; |
72
|
|
|
|
|
|
|
} |
73
|
|
|
|
|
|
|
|
74
|
47
|
|
|
47
|
1
|
159
|
sub wait { shift->exit } |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
sub exit { |
77
|
96
|
|
|
96
|
1
|
3306
|
my $self = shift; |
78
|
96
|
100
|
|
|
|
214
|
return 0 if $self->{idx} >= @{ $self->{array} }; |
|
96
|
|
|
|
|
2117
|
|
79
|
2
|
|
|
|
|
15
|
return; |
80
|
|
|
|
|
|
|
} |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
sub next_raw { |
83
|
314
|
|
|
314
|
1
|
593
|
my $self = shift; |
84
|
314
|
|
|
|
|
1143
|
return $self->{array}->[ $self->{idx}++ ]; |
85
|
|
|
|
|
|
|
} |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
1; |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
=head1 ATTRIBUTION |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
Originally ripped off from L. |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
=head1 SEE ALSO |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
L, |
96
|
|
|
|
|
|
|
L, |
97
|
|
|
|
|
|
|
L, |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
=cut |
100
|
|
|
|
|
|
|
|