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 - Internal TAP::Parser array Iterator
24 # see TAP::Parser::IteratorFactory for preferred usage
27 use TAP::Parser::Iterator::Array;
28 my @data = ('foo', 'bar', baz');
29 my $it = TAP::Parser::Iterator::Array->new(\@data);
34 This is a simple iterator wrapper for arrays of scalar content, used by
35 L<TAP::Parser>. Unless you're subclassing, you probably won't need to use
44 Create an iterator. Takes one argument: an C<$array_ref>
46 =head2 Instance Methods
50 Iterate through it, of course.
54 Iterate raw input without applying any fixes for quirky input syntax.
58 Get the wait status for this iterator. For an array iterator this will always
63 Get the exit status for this iterator. For an array iterator this will always
68 # new() implementation supplied by TAP::Object
71 my ( $self, $thing ) = @_;
74 $self->{array} = $thing;
75 $self->{exit} = undef;
79 sub wait { shift->exit }
83 return 0 if $self->{idx} >= @{ $self->{array} };
89 return $self->{array}->[ $self->{idx}++ ];
96 Originally ripped off from L<Test::Harness>.
102 L<TAP::Parser::Iterator>,
103 L<TAP::Parser::IteratorFactory>,