Server IP : 85.214.239.14 / Your IP : 52.15.109.209 Web Server : Apache/2.4.62 (Debian) System : Linux h2886529.stratoserver.net 4.9.0 #1 SMP Tue Jan 9 19:45:01 MSK 2024 x86_64 User : www-data ( 33) PHP Version : 7.4.18 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare, MySQL : OFF | cURL : OFF | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : OFF Directory : /proc/2/root/proc/3/task/3/cwd/usr/share/perl/5.36/TAP/Parser/Iterator/ |
Upload File : |
package TAP::Parser::Iterator::Array; use strict; use warnings; use base 'TAP::Parser::Iterator'; =head1 NAME TAP::Parser::Iterator::Array - Iterator for array-based TAP sources =head1 VERSION Version 3.44 =cut our $VERSION = '3.44'; =head1 SYNOPSIS 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<TAP::Parser>. Unless you're writing a plugin or subclassing, you probably won't need to use this module directly. =head1 METHODS =head2 Class Methods =head3 C<new> Create an iterator. Takes one argument: an C<$array_ref> =head2 Instance Methods =head3 C<next> Iterate through it, of course. =head3 C<next_raw> Iterate raw input without applying any fixes for quirky input syntax. =head3 C<wait> Get the wait status for this iterator. For an array iterator this will always be zero. =head3 C<exit> 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<Test::Harness>. =head1 SEE ALSO L<TAP::Object>, L<TAP::Parser>, L<TAP::Parser::Iterator>, =cut