1TAP::Parser::Source(3pm)Perl Programmers Reference GuideTAP::Parser::Source(3pm)
2
3
4

NAME

6       TAP::Parser::Source - Stream output from some source
7

VERSION

9       Version 3.17
10

SYNOPSIS

12         use TAP::Parser::Source;
13         my $source = TAP::Parser::Source->new;
14         my $stream = $source->source(['/usr/bin/ruby', 'mytest.rb'])->get_stream;
15

DESCRIPTION

17       Takes a command and hopefully returns a stream from it.
18

METHODS

20   Class Methods
21       "new"
22
23        my $source = TAP::Parser::Source->new;
24
25       Returns a new "TAP::Parser::Source" object.
26
27   Instance Methods
28       "source"
29
30        my $source = $source->source;
31        $source->source(['./some_prog some_test_file']);
32
33        # or
34        $source->source(['/usr/bin/ruby', 't/ruby_test.rb']);
35
36       Getter/setter for the source.  The source should generally consist of
37       an array reference of strings which, when executed via
38       &IPC::Open3::open3, should return a filehandle which returns successive
39       rows of TAP.  "croaks" if it doesn't get an arrayref.
40
41       "get_stream"
42
43        my $stream = $source->get_stream;
44
45       Returns a TAP::Parser::Iterator stream of the output generated by
46       executing "source".  "croak"s if there was no command found.
47
48       Must be passed an object that implements a "make_iterator" method.
49       Typically this is a TAP::Parser instance.
50
51       "merge"
52
53         my $merge = $source->merge;
54
55       Sets or returns the flag that dictates whether STDOUT and STDERR are
56       merged.
57

SUBCLASSING

59       Please see "SUBCLASSING" in TAP::Parser for a subclassing overview.
60
61   Example
62         package MyRubySource;
63
64         use strict;
65         use vars '@ISA';
66
67         use Carp qw( croak );
68         use TAP::Parser::Source;
69
70         @ISA = qw( TAP::Parser::Source );
71
72         # expect $source->(['mytest.rb', 'cmdline', 'args']);
73         sub source {
74           my ($self, $args) = @_;
75           my ($rb_file) = @$args;
76           croak("error: Ruby file '$rb_file' not found!") unless (-f $rb_file);
77           return $self->SUPER::source(['/usr/bin/ruby', @$args]);
78         }
79

SEE ALSO

81       TAP::Object, TAP::Parser, TAP::Parser::Source::Perl,
82
83
84
85perl v5.12.4                      2011-06-07          TAP::Parser::Source(3pm)
Impressum