.\" Automatically generated by Pod::Man 2.28 (Pod::Simple 3.29) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is turned on, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{ . if \nF \{ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "Attean::API::Iterator 3pm" .TH Attean::API::Iterator 3pm "2016-06-11" "perl v5.22.2" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" Attean::API::Iterator \- Typed iterator .SH "VERSION" .IX Header "VERSION" This document describes Attean::API::Iterator version 0.017 .SH "DESCRIPTION" .IX Header "DESCRIPTION" The Attean::API::Iterator role defines a common \s-1API\s0 for typed iterators. This package also defines several type-specific iterator roles: .IP "\(bu" 4 Attean::API::TripleIterator .IP "\(bu" 4 Attean::API::QuadIterator .IP "\(bu" 4 Attean::API::MixedStatementIterator .IP "\(bu" 4 Attean::API::ResultIterator .PP These roles will automatically be applied to iterators during construction when appropriate. .SH "ATTRIBUTES" .IX Header "ATTRIBUTES" The following attributes exist: .ie n .IP """item_type""" 4 .el .IP "\f(CWitem_type\fR" 4 .IX Item "item_type" A string indicating the type of elements returned by the iterator. .SH "REQUIRED METHODS" .IX Header "REQUIRED METHODS" The following methods are required by the Attean::API::Iterator role: .ie n .IP """next""" 4 .el .IP "\f(CWnext\fR" 4 .IX Item "next" Returns the next element from the iterator, or \f(CW\*(C`undef\*(C'\fR upon exhaustion. .SH "METHODS" .IX Header "METHODS" The Attean::API::Iterator role provides default implementations of the following methods: .ie n .IP """elements""" 4 .el .IP "\f(CWelements\fR" 4 .IX Item "elements" Returns a list of all remaining elements in the iterator. .ie n .IP """map( \e&mapper [, $result_type] )""" 4 .el .IP "\f(CWmap( \e&mapper [, $result_type] )\fR" 4 .IX Item "map( &mapper [, $result_type] )" Returns a new Attean::API::Iterator object with each element mapped using the supplied \f(CW&mapper\fR 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 \f(CW$result_type\fR object must indicate the new iterator's type information. .ie n .IP """grep( \e&filter )""" 4 .el .IP "\f(CWgrep( \e&filter )\fR" 4 .IX Item "grep( &filter )" Returns a new Attean::API::Iterator object that filters elements from the referent iterator based on whether calling \f(CW\*(C`&filter( $element )\*(C'\fR for each \&\f(CW$element\fR results in a true value. .ie n .IP """offset( $offset )""" 4 .el .IP "\f(CWoffset( $offset )\fR" 4 .IX Item "offset( $offset )" Returns the Attean::API::Iterator referent after skipping the first \&\f(CW$offset\fR elements. .ie n .IP """limit( $limit )""" 4 .el .IP "\f(CWlimit( $limit )\fR" 4 .IX Item "limit( $limit )" Returns a new Attean::API::Iterator object which returns the first \&\f(CW$limit\fR elements of the referent. .ie n .IP """materialize""" 4 .el .IP "\f(CWmaterialize\fR" 4 .IX Item "materialize" Returns a new Attean::API::RepeatableIterator object containing all the elements from the referent. .ie n .IP """debug( [$name] )""" 4 .el .IP "\f(CWdebug( [$name] )\fR" 4 .IX Item "debug( [$name] )" Print each item as it is consumed (with the string generated by \f(CW\*(C`as_string\*(C'\fR), prepended by \f(CW$name\fR. .SH "BUGS" .IX Header "BUGS" Please report any bugs or feature requests to through the GitHub web interface at . .SH "SEE ALSO" .IX Header "SEE ALSO" Attean::API::RepeatableIterator .PP .SH "AUTHOR" .IX Header "AUTHOR" Gregory Todd Williams \f(CW\*(C`\*(C'\fR .SH "COPYRIGHT" .IX Header "COPYRIGHT" 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 itself.