NAME

Iterator::Flex::Base - Iterator object

VERSION

version 0.33

METHODS

may

$bool = $iter->may( $method );

Similar to can, except it checks that the method can be called on the iterators which $iter depends on. For example, it's possible that $iter implements a rewind method, but that it's dependencies do not. In that case can will return true, but may will return false.

is_exhausted

$bool = $iter->is_exhausted

Returns true if the iterator is in the exhausted state

is_error

$bool = $self->is_error

Returns true if the iterator is in the error state

throws_on_exhaustion

$bool = $iter->throws_on_exhaustion;

Returns true if the iterator throws on exhaustion.

returns_on_exhaustion

$bool = $iter->returns_on_exhaustion;

Returns true if the iterator returns a sentinel on exhaustion.

buffer

$new_iter = $iter->buffer( $capacity = 0, ?\%pars );

Return a new iterator buffering the original iterator via Iterator::Flex::Buffer.

cache

$new_iter = $iter->cache( ?\%pars );

Return a new iterator caching the original iterator via Iterator::Flex::Cache.

cat

chain

$new_iter = $iter->cat( @iterables, ?\%pars );
$new_iter = $iter->chain( @iterables, ?\%pars );

Return a new iterator concatenating the original iterator with @iterables via Iterator::Flex::Cat.

chunk

batch

$new_iter = $iter->chunk( ?\%pars );
$new_iter = $iter->batch( ?\%pars );

Return a new iterator chunking the original iterator via Iterator::Flex::Chunk.

drain

\@values = $iter->drain( ?$nelem );

drains the iterator by repeatedly calling <$iter-next> until the iterator is exhausted. $iter will not throw if it signals exhaustion by throwing.

If $nelem is provided, it will return no more than $nelem at a time.

flatten

$new_iter = $iter->flatten;

Return a new iterator modifying the original iterator via Iterator::Flex::Flatten.

foreach

$iter->foreach( $coderef );

Calls the passed subroutine for each value returned by $iter. The value is made available to $iter in the $_ variable.

gather

$new_iter = $iter->gather( sub { ... }, ?\%pars );

Return a new iterator modifying the original iterator via Iterator::Flex::Gather.

grep

$new_iter = $iter->grep( sub { ... }, ?\%pars );

Return a new iterator modifying the original iterator via Iterator::Flex::Grep.

map

$new_iter = $iter->map( sub { ... } );

Return a new iterator modifying the original iterator via Iterator::Flex::Map.

take

$new_iter = $iter->take( $n, ?\%pars );

Return a new iterator yielding at most $n elements from $iter, via Iterator::Flex::Take.

SUPPORT

Bugs

Please report any bugs or feature requests to bug-iterator-flex@rt.cpan.org or through the web interface at: https://rt.cpan.org/Public/Dist/Display.html?Name=Iterator-Flex

Source

Source is available at

https://gitlab.com/djerius/iterator-flex

and may be cloned from

https://gitlab.com/djerius/iterator-flex.git

SEE ALSO

Please see those modules/websites for more information related to this module.

AUTHOR

Diab Jerius <djerius@cpan.org>

COPYRIGHT AND LICENSE

This software is Copyright (c) 2018 by Smithsonian Astrophysical Observatory.

This is free software, licensed under:

The GNU General Public License, Version 3, June 2007