1TAP::Parser::SourceHandUlseerr::CEoxnetcruitbaubtleedT(A3PP)e:r:lPaDrosceurm:e:nStoautricoenHandler::Executable(3)
2
3
4
6 TAP::Parser::SourceHandler::Executable - Stream output from an
7 executable TAP source
8
10 Version 3.44
11
13 use TAP::Parser::Source;
14 use TAP::Parser::SourceHandler::Executable;
15
16 my $source = TAP::Parser::Source->new->raw(['/usr/bin/ruby', 'mytest.rb']);
17 $source->assemble_meta;
18
19 my $class = 'TAP::Parser::SourceHandler::Executable';
20 my $vote = $class->can_handle( $source );
21 my $iter = $class->make_iterator( $source );
22
24 This is an executable TAP::Parser::SourceHandler - it has 2 jobs:
25
26 1. Figure out if the TAP::Parser::Source it's given is an executable
27 command ("can_handle").
28
29 2. Creates an iterator for executable commands ("make_iterator").
30
31 Unless you're writing a plugin or subclassing TAP::Parser, you probably
32 won't need to use this module directly.
33
35 Class Methods
36 "can_handle"
37
38 my $vote = $class->can_handle( $source );
39
40 Only votes if $source looks like an executable file. Casts the
41 following votes:
42
43 0.9 if it's a hash with an 'exec' key
44 0.8 if it's a .bat file
45 0.75 if it's got an execute bit set
46
47 "make_iterator"
48
49 my $iterator = $class->make_iterator( $source );
50
51 Returns a new TAP::Parser::Iterator::Process for the source.
52 "$source->raw" must be in one of the following forms:
53
54 { exec => [ @exec ] }
55
56 [ @exec ]
57
58 $file
59
60 "croak"s on error.
61
62 "iterator_class"
63
64 The class of iterator to use, override if you're sub-classing.
65 Defaults to TAP::Parser::Iterator::Process.
66
68 Please see "SUBCLASSING" in TAP::Parser for a subclassing overview.
69
70 Example
71 package MyRubySourceHandler;
72
73 use strict;
74
75 use Carp qw( croak );
76 use TAP::Parser::SourceHandler::Executable;
77
78 use base 'TAP::Parser::SourceHandler::Executable';
79
80 # expect $handler->(['mytest.rb', 'cmdline', 'args']);
81 sub make_iterator {
82 my ($self, $source) = @_;
83 my @test_args = @{ $source->test_args };
84 my $rb_file = $test_args[0];
85 croak("error: Ruby file '$rb_file' not found!") unless (-f $rb_file);
86 return $self->SUPER::raw_source(['/usr/bin/ruby', @test_args]);
87 }
88
90 TAP::Object, TAP::Parser, TAP::Parser::IteratorFactory,
91 TAP::Parser::SourceHandler, TAP::Parser::SourceHandler::Perl,
92 TAP::Parser::SourceHandler::File, TAP::Parser::SourceHandler::Handle,
93 TAP::Parser::SourceHandler::RawTAP
94
95
96
97perl v5.36.0 2022T-A0P7:-:2P2arser::SourceHandler::Executable(3)