X-Git-Url: http://vcs.maemo.org/git/?a=blobdiff_plain;f=dev%2Farm%2Flibtest-harness-perl%2Flibtest-harness-perl-3.12%2Flib%2FTAP%2FParser%2FIterator%2FArray.pm;fp=dev%2Farm%2Flibtest-harness-perl%2Flibtest-harness-perl-3.12%2Flib%2FTAP%2FParser%2FIterator%2FArray.pm;h=c6da8f79d83de7b23f555b5ece51f5017e7a9489;hb=f477fa73365d491991707e7ed9217b48d6994551;hp=0000000000000000000000000000000000000000;hpb=da95c414033799c3a62606f299c3c00b5c77ca11;p=dh-make-perl diff --git a/dev/arm/libtest-harness-perl/libtest-harness-perl-3.12/lib/TAP/Parser/Iterator/Array.pm b/dev/arm/libtest-harness-perl/libtest-harness-perl-3.12/lib/TAP/Parser/Iterator/Array.pm new file mode 100644 index 0000000..c6da8f7 --- /dev/null +++ b/dev/arm/libtest-harness-perl/libtest-harness-perl-3.12/lib/TAP/Parser/Iterator/Array.pm @@ -0,0 +1,107 @@ +package TAP::Parser::Iterator::Array; + +use strict; +use vars qw($VERSION @ISA); + +use TAP::Parser::Iterator (); + +@ISA = 'TAP::Parser::Iterator'; + +=head1 NAME + +TAP::Parser::Iterator::Array - Internal TAP::Parser array Iterator + +=head1 VERSION + +Version 3.12 + +=cut + +$VERSION = '3.12'; + +=head1 SYNOPSIS + + # see TAP::Parser::IteratorFactory for preferred usage + + # to use directly: + use TAP::Parser::Iterator::Array; + my @data = ('foo', 'bar', baz'); + my $it = TAP::Parser::Iterator::Array->new(\@data); + my $line = $it->next; + +=head1 DESCRIPTION + +This is a simple iterator wrapper for arrays of scalar content, used by +L. Unless you're subclassing, you probably won't need to use +this module directly. + +=head1 METHODS + +=head2 Class Methods + +=head3 C + +Create an iterator. Takes one argument: an C<$array_ref> + +=head2 Instance Methods + +=head3 C + +Iterate through it, of course. + +=head3 C + +Iterate raw input without applying any fixes for quirky input syntax. + +=head3 C + +Get the wait status for this iterator. For an array iterator this will always +be zero. + +=head3 C + +Get the exit status for this iterator. For an array iterator this will always +be zero. + +=cut + +# new() implementation supplied by TAP::Object + +sub _initialize { + my ( $self, $thing ) = @_; + chomp @$thing; + $self->{idx} = 0; + $self->{array} = $thing; + $self->{exit} = undef; + return $self; +} + +sub wait { shift->exit } + +sub exit { + my $self = shift; + return 0 if $self->{idx} >= @{ $self->{array} }; + return; +} + +sub next_raw { + my $self = shift; + return $self->{array}->[ $self->{idx}++ ]; +} + +1; + + +=head1 ATTRIBUTION + +Originally ripped off from L. + +=head1 SEE ALSO + +L, +L, +L, +L, + +=cut +