array.pm

来自「视频监控网络部分的协议ddns,的模块的实现代码,请大家大胆指正.」· PM 代码 · 共 87 行

PM
87
字号
package TAP::Parser::Iterator::Array;use strict;use TAP::Parser::Iterator ();use vars qw($VERSION @ISA);@ISA = 'TAP::Parser::Iterator';=head1 NAMETAP::Parser::Iterator::Array - Internal TAP::Parser Iterator=head1 VERSIONVersion 3.07=cut$VERSION = '3.07';=head1 SYNOPSIS  use TAP::Parser::Iterator::Array;  my $it = TAP::Parser::Iterator->new(\@array);  my $line = $it->next;Originally ripped off from L<Test::Harness>.=head1 DESCRIPTIONB<FOR INTERNAL USE ONLY!>This is a simple iterator wrapper for arrays.=head2 Class Methods=head3 C<new>Create an iterator.=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 alwaysbe zero.=head3 C<exit>Get the exit status for this iterator. For an array iterator this will alwaysbe zero.=cutsub new {    my ( $class, $thing ) = @_;    chomp @$thing;    bless {        idx   => 0,        array => $thing,        exit  => undef,    }, $class;}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;

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?