line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package TAP::Parser::SourceHandler::Handle; |
2
|
|
|
|
|
|
|
|
3
|
33
|
|
|
33
|
|
2095
|
use strict; |
|
33
|
|
|
|
|
38
|
|
|
33
|
|
|
|
|
756
|
|
4
|
33
|
|
|
33
|
|
161
|
use warnings; |
|
33
|
|
|
|
|
37
|
|
|
33
|
|
|
|
|
648
|
|
5
|
|
|
|
|
|
|
|
6
|
33
|
|
|
33
|
|
114
|
use TAP::Parser::IteratorFactory (); |
|
33
|
|
|
|
|
37
|
|
|
33
|
|
|
|
|
341
|
|
7
|
33
|
|
|
33
|
|
104
|
use TAP::Parser::Iterator::Stream (); |
|
33
|
|
|
|
|
35
|
|
|
33
|
|
|
|
|
538
|
|
8
|
|
|
|
|
|
|
|
9
|
33
|
|
|
33
|
|
112
|
use base 'TAP::Parser::SourceHandler'; |
|
33
|
|
|
|
|
43
|
|
|
33
|
|
|
|
|
7044
|
|
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.38 |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
=cut |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
our $VERSION = '3.38'; |
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
|
305
|
|
|
305
|
1
|
492
|
my ( $class, $src ) = @_; |
67
|
305
|
|
|
|
|
692
|
my $meta = $src->meta; |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
return 0.9 |
70
|
|
|
|
|
|
|
if $meta->{is_object} |
71
|
305
|
100
|
66
|
|
|
892
|
&& UNIVERSAL::isa( $src->raw, 'IO::Handle' ); |
72
|
|
|
|
|
|
|
|
73
|
303
|
100
|
|
|
|
717
|
return 0.8 if $meta->{is_glob}; |
74
|
|
|
|
|
|
|
|
75
|
297
|
|
|
|
|
539
|
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
|
15
|
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
|
|
|
14
|
|| UNIVERSAL::isa( $source->raw, 'IO::Handle' ); |
92
|
|
|
|
|
|
|
|
93
|
5
|
|
|
|
|
37
|
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
|
|
142
|
use constant iterator_class => 'TAP::Parser::Iterator::Stream'; |
|
33
|
|
|
|
|
40
|
|
|
33
|
|
|
|
|
1759
|
|
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 |