1 package Test
::Harness
::Iterator
;
9 Test::Harness::Iterator - Internal Test::Harness Iterator
13 use Test::Harness::Iterator;
14 my $it = Test::Harness::Iterator->new(\*TEST);
15 my $it = Test::Harness::Iterator->new(\@array);
21 B<FOR INTERNAL USE ONLY!>
23 This is a simple iterator wrapper for arrays and filehandles.
31 Iterate through it, of course.
36 my($proto, $thing) = @_;
39 if( ref $thing eq 'GLOB' ) {
40 bless $self, 'Test::Harness::Iterator::FH';
43 elsif( ref $thing eq 'ARRAY' ) {
44 bless $self, 'Test::Harness::Iterator::ARRAY';
46 $self->{array} = $thing;
49 warn "Can't iterate with a ", ref $thing;
55 package Test::Harness::Iterator::FH;
59 # readline() doesn't work so good on 5.5.4.
64 package Test::Harness::Iterator::ARRAY;
67 return $self->{array}->[$self->{idx}++];
70 "Steve Peters, Master Of True Value Finding, was here.";