1#============================================================= -*-Perl-*-
2#
3# Template::Plugin::Iterator
4#
5# DESCRIPTION
6#
7#   Plugin to create a Template::Iterator from a list of items and optional
8#   configuration parameters.
9#
10# AUTHOR
11#   Andy Wardley   <abw@wardley.org>
12#
13# COPYRIGHT
14#   Copyright (C) 2000-2007 Andy Wardley.  All Rights Reserved.
15#
16#   This module is free software; you can redistribute it and/or
17#   modify it under the same terms as Perl itself.
18#
19#============================================================================
20
21package Template::Plugin::Iterator;
22
23use strict;
24use warnings;
25use base 'Template::Plugin';
26use Template::Iterator;
27
28our $VERSION = 2.68;
29
30#------------------------------------------------------------------------
31# new($context, \@data, \%args)
32#------------------------------------------------------------------------
33
34sub new {
35    my $class   = shift;
36    my $context = shift;
37    Template::Iterator->new(@_);
38}
39
401;
41
42__END__
43
44=head1 NAME
45
46Template::Plugin::Iterator - Plugin to create iterators (Template::Iterator)
47
48=head1 SYNOPSIS
49
50    [% USE iterator(list, args) %]
51
52    [% FOREACH item = iterator %]
53       [% '<ul>' IF iterator.first %]
54       <li>[% item %]
55       [% '</ul>' IF iterator.last %]
56    [% END %]
57
58=head1 DESCRIPTION
59
60The iterator plugin provides a way to create a L<Template::Iterator> object
61to iterate over a data set.  An iterator is implicitly automatically by the
62L<FOREACH> directive.  This plugin allows the iterator to be explicitly created
63with a given name.
64
65=head1 AUTHOR
66
67Andy Wardley E<lt>abw@wardley.orgE<gt> L<http://wardley.org/>
68
69=head1 COPYRIGHT
70
71Copyright (C) 1996-2007 Andy Wardley.  All Rights Reserved.
72
73This module is free software; you can redistribute it and/or
74modify it under the same terms as Perl itself.
75
76=head1 SEE ALSO
77
78L<Template::Plugin>, L<Template::Iterator>
79
80=cut
81
82# Local Variables:
83# mode: perl
84# perl-indent-level: 4
85# indent-tabs-mode: nil
86# End:
87#
88# vim: expandtab shiftwidth=4:
89