-
-
06 Feb 2021 18:54:32 UTC
- Distribution: Attean
- Module version: 0.030
- Source (raw)
- Browse (raw)
- Changes
- Homepage
- How to Contribute
- Repository
- Issues (30)
- Testers (58 / 0 / 4)
- Kwalitee
Bus factor: 1- 66.75% Coverage
- License: perl_5
- Perl: v5.14.0
- Activity
24 month- Tools
- Download (245KB)
- MetaCPAN Explorer
- Permissions
- Subscribe to distribution
- Permalinks
- This version
- Latest version
- Dependencies
- Algorithm::Combinatorics
- DateTime::Format::W3CDTF
- Exporter::Tiny
- File::Slurp
- HTTP::Negotiate
- IRI
- JSON
- LWP::UserAgent
- List::MoreUtils
- Math::Cartesian::Product
- Module::Pluggable
- Moo
- MooX::Log::Any
- PerlIO::Layers
- Role::Tiny
- Set::Scalar
- Sub::Install
- Sub::Util
- Test::Modern
- Test::Moose
- Test::Roo
- Text::CSV
- Text::Table
- Try::Tiny
- Type::Tiny
- URI::Escape
- URI::NamespaceMap
- UUID::Tiny
- XML::SAX
- namespace::clean
- and possibly others
- Reverse dependencies
- CPAN Testers List
- Dependency graph
NAME
Attean::API::Iterator - Typed iterator
VERSION
This document describes Attean::API::Iterator version 0.030
DESCRIPTION
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 appropriate.
ATTRIBUTES
The following attributes exist:
item_type
-
A string indicating the type of elements returned by the iterator.
REQUIRED METHODS
The following methods are required by the Attean::API::Iterator role:
next
-
Returns the next element from the iterator, or
undef
upon exhaustion.
METHODS
The Attean::API::Iterator role provides default implementations of the following methods:
elements
-
Returns a list of all remaining elements in the iterator.
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 information. 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 value. 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. materialize
-
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
.
Methods on Roles Supporting Stringification
For iterators over roles that provide an
as_string
method, extra methods are provided. These iterators are:Attean::API::ResultOrTermIterator Attean::API::StatementIterator Attean::API::MixedStatementIterator Attean::API::ResultIterator Attean::API::TermIterator
They provide the following methods:
uniq
-
Returns a new iterator providing unique results (based on the stringified value of the underlying elements).
BUGS
Please report any bugs or feature requests to through the GitHub web interface at https://github.com/kasei/attean/issues.
SEE ALSO
Attean::API::RepeatableIterator
AUTHOR
Gregory Todd Williams
<gwilliams@cpan.org>
COPYRIGHT
Copyright (c) 2014--2020 Gregory Todd Williams. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
Module Install Instructions
To install Attean, copy and paste the appropriate command in to your terminal.
cpanm Attean
perl -MCPAN -e shell install Attean
For more information on module installation, please visit the detailed CPAN module installation guide.