1TAP::Parser::IteratorFacPteorrly(P3rpomg)rammers RefereTnAcPe::GPuairdseer::IteratorFactory(3pm)
2
3
4
6 TAP::Parser::IteratorFactory - Internal TAP::Parser Iterator
7
9 Version 3.17
10
12 use TAP::Parser::IteratorFactory;
13 my $factory = TAP::Parser::IteratorFactory->new;
14 my $iter = $factory->make_iterator(\*TEST);
15 my $iter = $factory->make_iterator(\@array);
16 my $iter = $factory->make_iterator(\%hash);
17
18 my $line = $iter->next;
19
21 This is a factory class for simple iterator wrappers for arrays,
22 filehandles, and hashes. Unless you're subclassing, you probably won't
23 need to use this module directly.
24
26 Class Methods
27 "new"
28
29 Creates a new factory class. Note: You currently don't need to
30 instantiate a factory in order to use it.
31
32 "make_iterator"
33
34 Create an iterator. The type of iterator created depends on the
35 arguments to the constructor:
36
37 my $iter = TAP::Parser::Iterator->make_iterator( $filehandle );
38
39 Creates a stream iterator (see "make_stream_iterator").
40
41 my $iter = TAP::Parser::Iterator->make_iterator( $array_reference );
42
43 Creates an array iterator (see "make_array_iterator").
44
45 my $iter = TAP::Parser::Iterator->make_iterator( $hash_reference );
46
47 Creates a process iterator (see "make_process_iterator").
48
49 "make_stream_iterator"
50
51 Make a new stream iterator and return it. Passes through any arguments
52 given. Defaults to a TAP::Parser::Iterator::Stream.
53
54 "make_array_iterator"
55
56 Make a new array iterator and return it. Passes through any arguments
57 given. Defaults to a TAP::Parser::Iterator::Array.
58
59 "make_process_iterator"
60
61 Make a new process iterator and return it. Passes through any
62 arguments given. Defaults to a TAP::Parser::Iterator::Process.
63
65 Please see "SUBCLASSING" in TAP::Parser for a subclassing overview.
66
67 There are a few things to bear in mind when creating your own
68 "ResultFactory":
69
70 1. The factory itself is never instantiated (this may change in the
71 future). This means that "_initialize" is never called.
72
73 Example
74 package MyIteratorFactory;
75
76 use strict;
77 use vars '@ISA';
78
79 use MyStreamIterator;
80 use TAP::Parser::IteratorFactory;
81
82 @ISA = qw( TAP::Parser::IteratorFactory );
83
84 # override stream iterator
85 sub make_stream_iterator {
86 my $proto = shift;
87 MyStreamIterator->new(@_);
88 }
89
90 1;
91
93 Originally ripped off from Test::Harness.
94
96 TAP::Object, TAP::Parser, TAP::Parser::Iterator,
97 TAP::Parser::Iterator::Array, TAP::Parser::Iterator::Stream,
98 TAP::Parser::Iterator::Process,
99
100
101
102perl v5.12.4 2011-06-07 TAP::Parser::IteratorFactory(3pm)