1 package TAP::Parser::Iterator;
4 use vars qw($VERSION @ISA);
8 @ISA = qw(TAP::Object);
12 TAP::Parser::Iterator - Internal base class for TAP::Parser Iterators
24 # see TAP::Parser::IteratorFactory for general usage
28 use TAP::Parser::Iterator ();
29 @ISA = qw(TAP::Parser::Iterator);
36 This is a simple iterator base class that defines L<TAP::Parser>'s iterator
37 API. See C<TAP::Parser::IteratorFactory> for the preferred way of creating
46 Create an iterator. Provided by L<TAP::Object>.
48 =head2 Instance Methods
52 while ( my $item = $iter->next ) { ... }
54 Iterate through it, of course.
58 B<Note:> this method is abstract and should be overridden.
60 while ( my $item = $iter->next_raw ) { ... }
62 Iterate raw input without applying any fixes for quirky input syntax.
68 my $line = $self->next_raw;
70 # vms nit: When encountering 'not ok', vms often has the 'not' on a line
74 if ( defined($line) and $line =~ /^\s*not\s*$/ ) {
75 $line .= ( $self->next_raw || '' );
83 my $msg = Carp::longmess('abstract method called directly!');
88 =head3 C<handle_unicode>
90 If necessary switch the input stream to handle unicode. This only has
91 any effect for I/O handle based streams.
93 The default implementation does nothing.
97 sub handle_unicode { }
100 =head3 C<get_select_handles>
102 Return a list of filehandles that may be used upstream in a select()
103 call to signal that this Iterator is ready. Iterators that are not
104 handle-based should return an empty list.
106 The default implementation does nothing.
110 sub get_select_handles {
117 B<Note:> this method is abstract and should be overridden.
119 my $wait_status = $iter->wait;
121 Return the C<wait> status for this iterator.
125 B<Note:> this method is abstract and should be overridden.
127 my $wait_status = $iter->exit;
129 Return the C<exit> status for this iterator.
135 my $msg = Carp::longmess('abstract method called directly!');
141 my $msg = Carp::longmess('abstract method called directly!');
150 Please see L<TAP::Parser/SUBCLASSING> for a subclassing overview.
152 You must override the abstract methods as noted above.
156 L<TAP::Parser::Iterator::Array> is probably the easiest example to follow.
157 There's not much point repeating it here.
163 L<TAP::Parser::IteratorFactory>,
164 L<TAP::Parser::Iterator::Array>,
165 L<TAP::Parser::Iterator::Stream>,
166 L<TAP::Parser::Iterator::Process>,