1 package TAP::Parser::Iterator::Array;
6 use base 'TAP::Parser::Iterator';
10 TAP::Parser::Iterator::Array - Iterator for array-based TAP sources
18 our $VERSION = '3.42';
22 use TAP::Parser::Iterator::Array;
23 my @data = ('foo', 'bar', baz');
24 my $it = TAP::Parser::Iterator::Array->new(\@data);
29 This is a simple iterator wrapper for arrays of scalar content, used by
30 L<TAP::Parser>. Unless you're writing a plugin or subclassing, you probably
31 won't need to use this module directly.
39 Create an iterator. Takes one argument: an C<$array_ref>
41 =head2 Instance Methods
45 Iterate through it, of course.
49 Iterate raw input without applying any fixes for quirky input syntax.
53 Get the wait status for this iterator. For an array iterator this will always
58 Get the exit status for this iterator. For an array iterator this will always
63 # new() implementation supplied by TAP::Object
66 my ( $self, $thing ) = @_;
69 $self->{array} = $thing;
70 $self->{exit} = undef;
74 sub wait { shift->exit }
78 return 0 if $self->{idx} >= @{ $self->{array} };
84 return $self->{array}->[ $self->{idx}++ ];
91 Originally ripped off from L<Test::Harness>.
97 L<TAP::Parser::Iterator>,