Attean::API::Iterator - Typed iterator
This document describes Attean::API::Iterator version 0.017
The Attean::API::Iterator role defines a common API for typed iterators. This
package also defines several type-specific iterator roles:
These roles will automatically be applied to iterators during construction when
The following attributes exist:
- A string indicating the type of elements returned by the
The following methods are required by the Attean::API::Iterator role:
- Returns the next element from the iterator, or
"undef" upon exhaustion.
The Attean::API::Iterator role provides default implementations of the following
- Returns a list of all remaining elements in the
- "map( \&mapper [, $result_type] )"
- Returns a new Attean::API::Iterator object with each
element mapped using the supplied &mapper function. If the iterator
elements are of the same type as those in the referent iterator, only a
mapping function is required. Otherwise, the supplied Type::Tiny
$result_type object must indicate the new iterator's type
- "grep( \&filter )"
- Returns a new Attean::API::Iterator object that filters
elements from the referent iterator based on whether calling
"&filter( $element )" for each $element results in a true
- "offset( $offset )"
- Returns the Attean::API::Iterator referent after skipping
the first $offset elements.
- "limit( $limit )"
- Returns a new Attean::API::Iterator object which returns
the first $limit elements of the referent.
- Returns a new Attean::API::RepeatableIterator object
containing all the elements from the referent.
- "debug( [$name] )"
- Print each item as it is consumed (with the string
generated by "as_string"), prepended by $name.
Please report any bugs or feature requests to through the GitHub web interface
Gregory Todd Williams "<firstname.lastname@example.org>"
Copyright (c) 2014--2016 Gregory Todd Williams. This program is free software;
you can redistribute it and/or modify it under the same terms as Perl