Attean::API::Iterator - Typed iterator
This document describes Attean::API::Iterator version 0.004
The Attean::API::Iterator role defines a common API for typed iterators. This package also defines several type-specific iterator roles:
Attean::API::TripleIterator
Attean::API::QuadIterator
Attean::API::MixedStatementIterator
Attean::API::ResultIterator
These roles will automatically be applied to iterators during construction when appropriate.
The following attributes exist:
item_type
A string indicating the type of elements returned by the iterator.
The following methods are required by the Attean::API::Iterator role:
next
Returns the next element from the iterator, or undef upon exhaustion.
undef
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.
&mapper
$result_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 value.
&filter( $element )
$element
offset( $offset )
Returns the Attean::API::Iterator referent after skipping the first $offset elements.
$offset
limit( $limit )
Returns a new Attean::API::Iterator object which returns the first $limit elements of the referent.
$limit
materialize
Returns a new Attean::API::RepeatableIterator object containing all the elements from the referent.
Please report any bugs or feature requests to through the GitHub web interface at https://github.com/kasei/attean/issues.
Attean::API::RepeatableIterator
http://www.perlrdf.org/
Gregory Todd Williams <gwilliams@cpan.org>
<gwilliams@cpan.org>
Copyright (c) 2014 Gregory Todd Williams. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install Attean, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Attean
CPAN shell
perl -MCPAN -e shell install Attean
For more information on module installation, please visit the detailed CPAN module installation guide.