1Attean::API::Iterator(3U)ser Contributed Perl DocumentatiAotntean::API::Iterator(3)
2
3
4
6 Attean::API::Iterator - Typed iterator
7
9 This document describes Attean::API::Iterator version 0.020
10
12 The Attean::API::Iterator role defines a common API for typed
13 iterators. This package also defines several type-specific iterator
14 roles:
15
16 · Attean::API::TripleIterator
17
18 · Attean::API::QuadIterator
19
20 · Attean::API::MixedStatementIterator
21
22 · Attean::API::ResultIterator
23
24 These roles will automatically be applied to iterators during
25 construction when appropriate.
26
28 The following attributes exist:
29
30 "item_type"
31 A string indicating the type of elements returned by the iterator.
32
34 The following methods are required by the Attean::API::Iterator role:
35
36 "next"
37 Returns the next element from the iterator, or "undef" upon
38 exhaustion.
39
41 The Attean::API::Iterator role provides default implementations of the
42 following methods:
43
44 "elements"
45 Returns a list of all remaining elements in the iterator.
46
47 "map( \&mapper [, $result_type] )"
48 Returns a new Attean::API::Iterator object with each element mapped
49 using the supplied &mapper function. If the iterator elements are
50 of the same type as those in the referent iterator, only a mapping
51 function is required. Otherwise, the supplied Type::Tiny
52 $result_type object must indicate the new iterator's type
53 information.
54
55 "grep( \&filter )"
56 Returns a new Attean::API::Iterator object that filters elements
57 from the referent iterator based on whether calling "&filter(
58 $element )" for each $element results in a true value.
59
60 "offset( $offset )"
61 Returns the Attean::API::Iterator referent after skipping the first
62 $offset elements.
63
64 "limit( $limit )"
65 Returns a new Attean::API::Iterator object which returns the first
66 $limit elements of the referent.
67
68 "materialize"
69 Returns a new Attean::API::RepeatableIterator object containing all
70 the elements from the referent.
71
72 "debug( [$name] )"
73 Print each item as it is consumed (with the string generated by
74 "as_string"), prepended by $name.
75
77 Please report any bugs or feature requests to through the GitHub web
78 interface at <https://github.com/kasei/attean/issues>.
79
81 Attean::API::RepeatableIterator
82
84 Gregory Todd Williams "<gwilliams@cpan.org>"
85
87 Copyright (c) 2014--2018 Gregory Todd Williams. This program is free
88 software; you can redistribute it and/or modify it under the same terms
89 as Perl itself.
90
91
92
93perl v5.28.1 2019-01-09 Attean::API::Iterator(3)