Perl: Update "prove" and add its dependencies so it actually works (again)
[msysgit.git] / lib / perl5 / 5.8.8 / TAP / Parser / Iterator / Array.pm
blob4a195849bc9940c32e76f886a8bc946297120fb7
1 package TAP::Parser::Iterator::Array;
3 use strict;
4 use vars qw($VERSION @ISA);
6 use TAP::Parser::Iterator ();
8 @ISA = 'TAP::Parser::Iterator';
10 =head1 NAME
12 TAP::Parser::Iterator::Array - Iterator for array-based TAP sources
14 =head1 VERSION
16 Version 3.23
18 =cut
20 $VERSION = '3.23';
22 =head1 SYNOPSIS
24 use TAP::Parser::Iterator::Array;
25 my @data = ('foo', 'bar', baz');
26 my $it = TAP::Parser::Iterator::Array->new(\@data);
27 my $line = $it->next;
29 =head1 DESCRIPTION
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.
35 =head1 METHODS
37 =head2 Class Methods
39 =head3 C<new>
41 Create an iterator. Takes one argument: an C<$array_ref>
43 =head2 Instance Methods
45 =head3 C<next>
47 Iterate through it, of course.
49 =head3 C<next_raw>
51 Iterate raw input without applying any fixes for quirky input syntax.
53 =head3 C<wait>
55 Get the wait status for this iterator. For an array iterator this will always
56 be zero.
58 =head3 C<exit>
60 Get the exit status for this iterator. For an array iterator this will always
61 be zero.
63 =cut
65 # new() implementation supplied by TAP::Object
67 sub _initialize {
68 my ( $self, $thing ) = @_;
69 chomp @$thing;
70 $self->{idx} = 0;
71 $self->{array} = $thing;
72 $self->{exit} = undef;
73 return $self;
76 sub wait { shift->exit }
78 sub exit {
79 my $self = shift;
80 return 0 if $self->{idx} >= @{ $self->{array} };
81 return;
84 sub next_raw {
85 my $self = shift;
86 return $self->{array}->[ $self->{idx}++ ];
91 =head1 ATTRIBUTION
93 Originally ripped off from L<Test::Harness>.
95 =head1 SEE ALSO
97 L<TAP::Object>,
98 L<TAP::Parser>,
99 L<TAP::Parser::Iterator>,
101 =cut