Template::Iterator - Base iterator class used by the FOREACH directive.
my $iter = Template::Iterator->new(\@data, \%options);
The Template::Iterator module defines a generic data iterator for use by the FOREACH directive.
It may be used as the base class for custom iterators.
Constructor method. A reference to a list of values is passed as the first parameter and subsequent get_first() and get_next() calls will return each element.
Returns a ($value, $error) pair for the first item in the iterator set. The $error returned may be zero or undefined to indicate a valid datum was successfully returned. Returns an error of STATUS_DONE if the list is empty.
Returns a ($value, $error) pair for the next item in the iterator set. Returns an error of STATUS_DONE if all items in the list have been visited.
Returns a (\@values, $error) pair for all remaining items in the iterator set. Returns an error of STATUS_DONE if all items in the list have been visited.
Return the size of the iteration set, the maximum index number (size - 1), the current index number (0..max), the iteration number offset from 1 (index + 1, i.e. 1..size), and boolean values indicating if the current iteration is the first or last in the set, respectively.
Andy Wardley <abw@kfs.org>
http://www.template-toolkit.org/ http://www.kfs.org/~abw/
$Revision: 1.1 $
Copyright (C) 1996-2000 Andy Wardley. All Rights Reserved. Copyright (C) 1998-2000 Canon Research Centre Europe Ltd.
This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
Template
To install Template, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Template
CPAN shell
perl -MCPAN -e shell install Template
For more information on module installation, please visit the detailed CPAN module installation guide.