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!');
87 =head3 C<handle_unicode>
89 If necessary switch the input stream to handle unicode. This only has
90 any effect for I/O handle based streams.
92 The default implementation does nothing.
96 sub handle_unicode { }
98 =head3 C<get_select_handles>
100 Return a list of filehandles that may be used upstream in a select()
101 call to signal that this Iterator is ready. Iterators that are not
102 handle-based should return an empty list.
104 The default implementation does nothing.
108 sub get_select_handles {
114 B<Note:> this method is abstract and should be overridden.
116 my $wait_status = $iter->wait;
118 Return the C<wait> status for this iterator.
122 B<Note:> this method is abstract and should be overridden.
124 my $wait_status = $iter->exit;
126 Return the C<exit> status for this iterator.
132 my $msg = Carp::longmess('abstract method called directly!');
138 my $msg = Carp::longmess('abstract method called directly!');
146 Please see L<TAP::Parser/SUBCLASSING> for a subclassing overview.
148 You must override the abstract methods as noted above.
152 L<TAP::Parser::Iterator::Array> is probably the easiest example to follow.
153 There's not much point repeating it here.
159 L<TAP::Parser::IteratorFactory>,
160 L<TAP::Parser::Iterator::Array>,
161 L<TAP::Parser::Iterator::Stream>,
162 L<TAP::Parser::Iterator::Process>,