[Templates] Loop VMethods docpatch
Hakim Cassimally
hakim.cassimally@gmail.com
Thu, 8 Feb 2007 11:50:19 +0100
Hi,
I regularly [0] get very confused looking for vmethods on loop
iterators in TT.
The lovely castaway pointed me at Template::Manual::Directives,
but I thought I'd submit this docpatch just in case she isn't around
the next time I (or someone else) have the same problem.
A patch for Template/Manual/VMethods.pod follows,
- osfameron
[0] not as regularly as I'm like as I'm currently working with
HTML::Tem... gah, let me not sully the list with its name
--- VMethods.pod 2007-02-08 10:24:07.000000000 +0100
+++ VMethods.pod.patch 2007-02-08 10:39:04.000000000 +0100
@@ -424,6 +424,18 @@
=back
+=head2 Iterator Virtual Methods
+
+There are virtual methods that can be called on the iterator
variable, for example
+to check if it is the first or last item, an odd or an even item, etc.
+
+ [% FOREACH i = list %]
+ [% IF i.first() %] First Line [% END %]
+ ....
+ [% END %]
+
+These are documented fully under L<Template::Manual::Directives/Loop
Processing>.
+
=head2 Automagic Promotion of Scalar to List for Virtual Methods
In addition to the scalar virtual methods listed in the previous