1 package TAP
::Parser
::Iterator
::Array
;
4 use vars
qw($VERSION @ISA);
6 use TAP::Parser::Iterator ();
8 @ISA = 'TAP::Parser::Iterator';
12 TAP::Parser::Iterator::Array - Iterator for array-based TAP sources
24 use TAP::Parser::Iterator::Array;
25 my @data = ('foo', 'bar', baz');
26 my $it = TAP::Parser::Iterator::Array->new(\@data);
31 This is a simple iterator wrapper for arrays of scalar content, used by
32 L<TAP::Parser>. Unless you're writing a plugin or subclassing, you probably
33 won't need to use this module directly.
41 Create an iterator. Takes one argument: an C<$array_ref>
43 =head2 Instance Methods
47 Iterate through it, of course.
51 Iterate raw input without applying any fixes for quirky input syntax.
55 Get the wait status for this iterator. For an array iterator this will always
60 Get the exit status for this iterator. For an array iterator this will always
65 # new() implementation supplied by TAP::Object
68 my ( $self, $thing ) = @_;
71 $self->{array} = $thing;
72 $self->{exit} = undef;
76 sub wait { shift->exit }
80 return 0 if $self->{idx} >= @{ $self->{array} };
86 return $self->{array}->[ $self->{idx}++ ];
93 Originally ripped off from L<Test::Harness>.
99 L<TAP::Parser::Iterator>,