The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

WebService::OpenSky::Utils::Iterator - Internal iterator class for WebService::OpenSky

VERSION

version 0.4

SYNOPSIS

use WebService::OpenSky::Utils::Iterator;

my $results = WebService::OpenSky::Utils::Iterator->new( rows => [ 1, 2, 3 ] );

while ( my $result = $results->next ) {
    ...
}

DESCRIPTION

A simple iterator class. To keep it dead simple, it only allows defined values to be passed in.

METHODS

next

while ( my $result = $results->next ) {
    ...
}

Returns the next member in the iterator. Returns undef if the iterator is exhausted.

count

if ( $results->count ) {
    ...
}

Returns the number of members in the iterator.

first

my $object = $results->first;

Returns the first object in the results.

reset

$results->reset;

Resets the iterator to point to the first member.

all

my @objects = $results->all;

Returns a list of all members in the iterator.

AUTHOR

Curtis "Ovid" Poe <curtis.poe@gmail.com>

COPYRIGHT AND LICENSE

This software is Copyright (c) 2023 by Curtis "Ovid" Poe.

This is free software, licensed under:

The Artistic License 2.0 (GPL Compatible)