File Coverage

blib/lib/TAP/Parser/Iterator/Stream/Selectable.pm
Criterion Covered Total %
statement 20 23 86.9
branch 2 4 50.0
condition 1 2 50.0
subroutine 4 5 80.0
pod 1 1 100.0
total 28 35 80.0


line stmt bran cond sub pod time code
1             package TAP::Parser::Iterator::Stream::Selectable;
2 2     2   674 use strict;
  2         4  
  2         80  
3 2     2   43 use vars (qw($VERSION @ISA));
  2         5  
  2         107  
4              
5 2     2   1178 use TAP::Parser::Iterator::Stream ();
  2         439  
  2         455  
6             @ISA = 'TAP::Parser::Iterator::Stream';
7              
8             =head1 NAME
9              
10             TAP::Parser::Iterator::Stream::Selectable - Stream TAP from an L or a GLOB.
11              
12             =head1 VERSION
13              
14             Version 0.01
15              
16             =cut
17              
18             $VERSION = '0.01';
19              
20             sub _initialize {
21 2     2   179977 my ( $self, $args ) = @_;
22 2 50       29 unless ( $args->{handle} ) {
23 0         0 die "handle argument must be specified.\n";
24             }
25 2   50     50 my $chunk_size = delete $args->{_chunk_size} || 65536;
26 2 50       74 return unless ( $self->SUPER::_initialize( $args->{handle} ) );
27 2         78 $self->{out} = $args->{handle};
28 2         10 $self->{err} = $args->{handle};
29 2         36 $self->{sel} = IO::Select->new( $args->{handle} );
30 2         201 $self->{pid} = '';
31 2         130 $self->{exit} = undef;
32 2         9 $self->{chunk_size} = $chunk_size;
33 2         20 return $self;
34             }
35              
36             =head3 C
37              
38             Return a list of filehandles that may be used upstream in a select()
39             call to signal that this Iterator is ready. Iterators that are not
40             handle based should return an empty list.
41              
42             =cut
43              
44             sub get_select_handles {
45 0     0 1   my $self = shift;
46 0           return grep $_, ( $self->{out}, $self->{err} );
47             }
48              
49             1;
50              
51             __END__