line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package TAP::Parser::SourceHandler::Handle; |
2
|
|
|
|
|
|
|
|
3
|
33
|
|
|
33
|
|
2604
|
use strict; |
|
33
|
|
|
|
|
105
|
|
|
33
|
|
|
|
|
1090
|
|
4
|
33
|
|
|
33
|
|
231
|
use warnings; |
|
33
|
|
|
|
|
101
|
|
|
33
|
|
|
|
|
1039
|
|
5
|
|
|
|
|
|
|
|
6
|
33
|
|
|
33
|
|
221
|
use TAP::Parser::IteratorFactory (); |
|
33
|
|
|
|
|
166
|
|
|
33
|
|
|
|
|
688
|
|
7
|
33
|
|
|
33
|
|
208
|
use TAP::Parser::Iterator::Stream (); |
|
33
|
|
|
|
|
88
|
|
|
33
|
|
|
|
|
867
|
|
8
|
|
|
|
|
|
|
|
9
|
33
|
|
|
33
|
|
207
|
use base 'TAP::Parser::SourceHandler'; |
|
33
|
|
|
|
|
90
|
|
|
33
|
|
|
|
|
9798
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
TAP::Parser::IteratorFactory->register_handler(__PACKAGE__); |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
=head1 NAME |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
TAP::Parser::SourceHandler::Handle - Stream TAP from an IO::Handle or a GLOB. |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
=head1 VERSION |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
Version 3.40_01 |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
=cut |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
our $VERSION = '3.40_01'; |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
=head1 SYNOPSIS |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
use TAP::Parser::Source; |
28
|
|
|
|
|
|
|
use TAP::Parser::SourceHandler::Executable; |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
my $source = TAP::Parser::Source->new->raw( \*TAP_FILE ); |
31
|
|
|
|
|
|
|
$source->assemble_meta; |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
my $class = 'TAP::Parser::SourceHandler::Handle'; |
34
|
|
|
|
|
|
|
my $vote = $class->can_handle( $source ); |
35
|
|
|
|
|
|
|
my $iter = $class->make_iterator( $source ); |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
=head1 DESCRIPTION |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
This is a I L class. It |
40
|
|
|
|
|
|
|
has 2 jobs: |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
1. Figure out if the L it's given is an L or |
43
|
|
|
|
|
|
|
GLOB containing raw TAP output (L). |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
2. Creates an iterator for IO::Handle's & globs (L). |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
Unless you're writing a plugin or subclassing L, you probably |
48
|
|
|
|
|
|
|
won't need to use this module directly. |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
=head1 METHODS |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
=head2 Class Methods |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
=head3 C |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
my $vote = $class->can_handle( $source ); |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
Casts the following votes: |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
0.9 if $source is an IO::Handle |
61
|
|
|
|
|
|
|
0.8 if $source is a glob |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
=cut |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
sub can_handle { |
66
|
308
|
|
|
308
|
1
|
1164
|
my ( $class, $src ) = @_; |
67
|
308
|
|
|
|
|
1737
|
my $meta = $src->meta; |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
return 0.9 |
70
|
|
|
|
|
|
|
if $meta->{is_object} |
71
|
308
|
100
|
66
|
|
|
1863
|
&& UNIVERSAL::isa( $src->raw, 'IO::Handle' ); |
72
|
|
|
|
|
|
|
|
73
|
306
|
100
|
|
|
|
1442
|
return 0.8 if $meta->{is_glob}; |
74
|
|
|
|
|
|
|
|
75
|
300
|
|
|
|
|
1235
|
return 0; |
76
|
|
|
|
|
|
|
} |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
=head3 C |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
my $iterator = $class->make_iterator( $source ); |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
Returns a new L for the source. |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
=cut |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
sub make_iterator { |
87
|
5
|
|
|
5
|
1
|
24
|
my ( $class, $source ) = @_; |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
$class->_croak('$source->raw must be a glob ref or an IO::Handle') |
90
|
|
|
|
|
|
|
unless $source->meta->{is_glob} |
91
|
5
|
50
|
66
|
|
|
25
|
|| UNIVERSAL::isa( $source->raw, 'IO::Handle' ); |
92
|
|
|
|
|
|
|
|
93
|
5
|
|
|
|
|
50
|
return $class->iterator_class->new( $source->raw ); |
94
|
|
|
|
|
|
|
} |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
=head3 C |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
The class of iterator to use, override if you're sub-classing. Defaults |
99
|
|
|
|
|
|
|
to L. |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
=cut |
102
|
|
|
|
|
|
|
|
103
|
33
|
|
|
33
|
|
274
|
use constant iterator_class => 'TAP::Parser::Iterator::Stream'; |
|
33
|
|
|
|
|
91
|
|
|
33
|
|
|
|
|
2662
|
|
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
1; |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
=head1 SUBCLASSING |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
Please see L for a subclassing overview. |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
=head1 SEE ALSO |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
L, |
114
|
|
|
|
|
|
|
L, |
115
|
|
|
|
|
|
|
L, |
116
|
|
|
|
|
|
|
L, |
117
|
|
|
|
|
|
|
L, |
118
|
|
|
|
|
|
|
L, |
119
|
|
|
|
|
|
|
L, |
120
|
|
|
|
|
|
|
L, |
121
|
|
|
|
|
|
|
L, |
122
|
|
|
|
|
|
|
L |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
=cut |