.\" Automatically generated by Pod::Man 4.11 (Pod::Simple 3.35) .\" .\" 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 >0, 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 "Data::TableReader::Iterator 3pm" .TH Data::TableReader::Iterator 3pm "2020-08-20" "perl v5.30.3" "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" Data::TableReader::Iterator \- Base class for iterators (blessed coderefs) .SH "VERSION" .IX Header "VERSION" version 0.011 .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 10 \& my $iter= $record_reader\->iterator; \& while (my $rec= $iter\->()) { \& ... \& my $position= $iter\->tell; \& print "Marking position $position"; # position stringifies to human\-readable \& ... \& $iter\->seek($position); \& } \& if ($iter\->next_dataset) { \& # iterate some more \& while ($rec= $iter\->()) { \& ... \& printf "Have processed %3d %% of the file", $iter\->progress*100; \& } \& } .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" This is the abstract base class for iterators used in Data::TableReader, which are blessed coderefs that return records on each call. .PP The coderef should support a single argument of a \*(L"slice\*(R" to extract from the record, in case not all of the record is needed. .SH "ATTRIBUTES" .IX Header "ATTRIBUTES" .SS "position" .IX Subsection "position" Return a human-readable string describing the current location within the source file. This will be something like \f(CW"$filename row $row"\fR or \f(CW"$filename $worksheet:$cell_id"\fR. .SS "progress" .IX Subsection "progress" An estimate of how much of the data has already been returned. If the stream is not seekable this may return undef. .SH "METHODS" .IX Header "METHODS" .SS "new" .IX Subsection "new" .Vb 1 \& $iter= Data::TableReader::Iterator\->new( \e&coderef, \e%fields ); .Ve .PP The iterator is a blessed coderef. The first argument is the coderef to be blessed, and the second argument is the magic hashref of fields to be made available as \&\f(CW\*(C`$iter\->_fields\*(C'\fR. .SS "tell" .IX Subsection "tell" If seeking is supported, this will return some value that can be passed to seek to come back to this point in the stream. This value will always be true. If seeking is not supported this will return undef. .SS "seek" .IX Subsection "seek" .Vb 1 \& $iter\->seek($pos); .Ve .PP Seek to a point previously reported by \*(L"tell\*(R". If seeking is not supported this will die. If \f(CW$pos\fR is any false value it means to seek to the start of the stream. .SS "next_dataset" .IX Subsection "next_dataset" If a file format supports more than one tabular group of data, this method allows you to jump to the next. .SH "AUTHOR" .IX Header "AUTHOR" Michael Conrad .SH "COPYRIGHT AND LICENSE" .IX Header "COPYRIGHT AND LICENSE" This software is copyright (c) 2019 by Michael Conrad. .PP This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.