.\" Automatically generated by Pod::Man 4.10 (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 "HTML::Template::SYNTAX 3pm"
.TH HTML::Template::SYNTAX 3pm "2018-11-01" "perl v5.28.0" "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"
HTML::Template::SYNTAX \- syntax of html template language for HTML::Template
.SH "SYNOPSIS"
.IX Header "SYNOPSIS"
This help is only on syntax of html template files.
For perl interface of HTML::Template::Pro you should see
\&\*(L"\s-1SYNOPSIS\*(R"\s0 in HTML::Template::PerlInterface.
.PP
First you make a template \- this is just a normal \s-1HTML\s0 file with a few
extra tags, the simplest being <\s-1TMPL_VAR\s0>
.PP
For example, test.tmpl:
.PP
.Vb 8
\&
\&
Test Template
\&
\& My Home Directory is
\&
\& My Path is set to
\&
\&
.Ve
.PP
Now define the value for \s-1HOME\s0 and \s-1PATH,\s0 for example,
in perl it will look like
.PP
.Vb 2
\& $template\->param(HOME => $ENV{HOME});
\& $template\->param(PATH => $ENV{PATH});
.Ve
.PP
and process the template. If all is well in the universe
this should show something like this in your browser:
.PP
.Vb 2
\& My Home Directory is /home/some/directory
\& My Path is set to /bin;/usr/bin
.Ve
.SH "DESCRIPTION"
.IX Header "DESCRIPTION"
This module attempts to make using \s-1HTML\s0 templates simple and natural.
It extends standard \s-1HTML\s0 with a few new HTML-esque tags \- <\s-1TMPL_VAR\s0>,
<\s-1TMPL_LOOP\s0>, <\s-1TMPL_INCLUDE\s0>, <\s-1TMPL_IF\s0>, <\s-1TMPL_ELSE\s0> and <\s-1TMPL_UNLESS\s0>.
(HTML::Template::Pro also supports <\s-1TMPL_ELSIF\s0> tag.)
The file written with \s-1HTML\s0 and these new tags is called a template.
It is usually saved separate from your script \- possibly even created
by someone else! Using this module you fill in the values for the
variables, loops and branches declared in the template. This allows
you to separate design \- the \s-1HTML\s0 \- from the data, which you generate
in the Perl script.
.PP
This module is licensed under the (L)GPL or perl license.
See the \s-1LICENSE\s0 section below for more details.
.SH "TUTORIAL"
.IX Header "TUTORIAL"
If you're new to HTML::Template, I suggest you start with the
introductory article available on the HTML::Template website:
.PP
.Vb 1
\& http://html\-template.sourceforge.net
.Ve
.SH "MOTIVATION"
.IX Header "MOTIVATION"
It is true that there are a number of packages out there to do \s-1HTML\s0
templates. On the one hand you have things like HTML::Embperl which
allows you freely mix Perl with \s-1HTML.\s0 On the other hand lie
home-grown variable substitution solutions. Hopefully the module can
find a place between the two.
.PP
One advantage of this module over a full HTML::Embperl\-esque solution
is that it enforces an important divide \- design and programming. By
limiting the programmer to just using simple variables and loops in
the \s-1HTML,\s0 the template remains accessible to designers and other
non-perl people. The use of HTML-esque syntax goes further to make
the format understandable to others. In the future this similarity
could be used to extend existing \s-1HTML\s0 editors/analyzers to support
HTML::Template.
.PP
An advantage of this module over home-grown tag-replacement schemes is
the support for loops. In my work I am often called on to produce
tables of data in html. Producing them using simplistic \s-1HTML\s0
templates results in CGIs containing lots of \s-1HTML\s0 since the \s-1HTML\s0
itself cannot represent loops. The introduction of loop statements in
the \s-1HTML\s0 simplifies this situation considerably. The designer can
layout a single row and the programmer can fill it in as many times as
necessary \- all they must agree on is the parameter names.
.PP
For all that, I think the best thing about this module is that it does
just one thing and it does it quickly and carefully. It doesn't try
to replace Perl and \s-1HTML,\s0 it just augments them to interact a little
better. And it's pretty fast.
.SH "THE TAGS"
.IX Header "THE TAGS"
.SS "\s-1GENERAL TAG SYNTAX\s0"
.IX Subsection "GENERAL TAG SYNTAX"
A generic HTML::Template tag that is supported by HTML::Template::Pro
looks like <\s-1TMPL_SOMETHING\s0 A=\*(L"B\*(R" [C=\*(L"D\*(R" ...]>. Tags are case-insensitve:
is acceptable.
Single quotes can be used, <\s-1TMPL_SOMETHING\s0 A='B' [C='D' ...]>
quotes can be omitted, <\s-1TMPL_SOMETHING\s0 A=B ... >
and option name could be often guessed as in <\s-1TMPL_SOMETHING B\s0>.
.PP
template tags could be decorated as html comments
.PP
Also, as HTML::Template::Pro extension (starting from version 0.90),
template tags could also be decorated as xml
<\s-1TMPL_SOMETHING\s0 A=\*(L"B\*(R" />
.PP
See \s-1NOTES\s0.
.SS "\s-1TMPL_VAR\s0"
.IX Subsection "TMPL_VAR"
.Vb 1
\&
.Ve
.PP
The <\s-1TMPL_VAR\s0> tag is very simple. For each <\s-1TMPL_VAR\s0> tag in the
template you call \f(CW$template\fR\->param(\s-1PARAMETER_NAME\s0 => \*(L"\s-1VALUE\*(R"\s0). When
the template is output the <\s-1TMPL_VAR\s0> is replaced with the \s-1VALUE\s0 text
you specified. If you don't set a parameter it just gets skipped in
the output.
.PP
Optionally you can use the \*(L"ESCAPE=HTML\*(R" option in the tag to indicate
that you want the value to be HTML-escaped before being returned from
output (the old ESCAPE=1 syntax is still supported). This means that
the ", <, >, and & characters get translated into ", <, >
and & respectively. This is useful when you want to use a
\&\s-1TMPL_VAR\s0 in a context where those characters would cause trouble.
Example:
.PP
.Vb 1
\& ">
.Ve
.PP
If you called \f(CW\*(C`param()\*(C'\fR with a value like sam"my you'll get in trouble
with \s-1HTML\s0's idea of a double-quote. On the other hand, if you use
ESCAPE=HTML, like this:
.PP
.Vb 1
\& ">
.Ve
.PP
You'll get what you wanted no matter what value happens to be passed in for
param. You can also write ESCAPE=\*(L"\s-1HTML\*(R",\s0 ESCAPE='\s-1HTML\s0' and ESCAPE='1'.
.PP
\&\*(L"ESCAPE=0\*(R" and \*(L"ESCAPE=NONE\*(R" turn off escaping, which is the default
behavior.
.PP
There is also the \*(L"ESCAPE=URL\*(R" option which may be used for VARs that
populate a \s-1URL.\s0 It will do \s-1URL\s0 escaping, like replacing ' ' with '+'
and '/' with '%2F'.
.PP
There is also the \*(L"ESCAPE=JS\*(R" option which may be used for VARs that
need to be placed within a Javascript string. All \en, \er, ' and " characters
are escaped.
.PP
You can assign a default value to a variable with the \s-1DEFAULT\s0
attribute. For example, this will output \*(L"the devil gave me a taco\*(R"
if the \*(L"who\*(R" variable is not set.
.PP
.Vb 1
\& The gave me a taco.
.Ve
.SS "\s-1TMPL_LOOP\s0"
.IX Subsection "TMPL_LOOP"
.Vb 1
\& ...
.Ve
.PP
The <\s-1TMPL_LOOP\s0> tag is a bit more complicated than <\s-1TMPL_VAR\s0>. The
<\s-1TMPL_LOOP\s0> tag allows you to delimit a section of text and give it a
name. Inside this named loop you place <\s-1TMPL_VAR\s0>s. Now you pass to
\&\f(CW\*(C`param()\*(C'\fR a list (an array ref) of parameter assignments (hash refs) for
this loop. The loop iterates over the list and produces output from
the text block for each pass. Unset parameters are skipped. Here's
an example:
.PP
.Vb 1
\& In the template:
\&
\&
\& Name:
\& Job:
\&
\&
\&
\& In the script:
\&
\& $template\->param(EMPLOYEE_INFO => [
\& { name => \*(AqSam\*(Aq, job => \*(Aqprogrammer\*(Aq },
\& { name => \*(AqSteve\*(Aq, job => \*(Aqsoda jerk\*(Aq },
\& ]
\& );
\& print $template\->output();
\&
\&
\& The output in a browser:
\&
\& Name: Sam
\& Job: programmer
\&
\& Name: Steve
\& Job: soda jerk
.Ve
.PP
As you can see above the <\s-1TMPL_LOOP\s0> takes a list of variable
assignments and then iterates over the loop body producing output.
.PP
Often you'll want to generate a <\s-1TMPL_LOOP\s0>'s contents
programmatically. Here's an example of how this can be done (many
other ways are possible!):
.PP
.Vb 3
\& # a couple of arrays of data to put in a loop:
\& my @words = qw(I Am Cool);
\& my @numbers = qw(1 2 3);
\&
\& my @loop_data = (); # initialize an array to hold your loop
\&
\& while (@words and @numbers) {
\& my %row_data; # get a fresh hash for the row data
\&
\& # fill in this row
\& $row_data{WORD} = shift @words;
\& $row_data{NUMBER} = shift @numbers;
\&
\& # the crucial step \- push a reference to this row into the loop!
\& push(@loop_data, \e%row_data);
\& }
\&
\& # finally, assign the loop data to the loop param, again with a
\& # reference:
\& $template\->param(THIS_LOOP => \e@loop_data);
.Ve
.PP
The above example would work with a template like:
.PP
.Vb 4
\&
\& Word:
\& Number:
\&
.Ve
.PP
It would produce output like:
.PP
.Vb 2
\& Word: I
\& Number: 1
\&
\& Word: Am
\& Number: 2
\&
\& Word: Cool
\& Number: 3
.Ve
.PP
<\s-1TMPL_LOOP\s0>s within <\s-1TMPL_LOOP\s0>s are fine and work as you would
expect. If the syntax for the \f(CW\*(C`param()\*(C'\fR call has you stumped, here's an
example of a param call with one nested loop:
.PP
.Vb 9
\& $template\->param(LOOP => [
\& { name => \*(AqBobby\*(Aq,
\& nicknames => [
\& { name => \*(Aqthe big bad wolf\*(Aq },
\& { name => \*(AqHe\-Man\*(Aq },
\& ],
\& },
\& ],
\& );
.Ve
.PP
Basically, each <\s-1TMPL_LOOP\s0> gets an array reference. Inside the array
are any number of hash references. These hashes contain the
name=>value pairs for a single pass over the loop template.
.PP
Inside a <\s-1TMPL_LOOP\s0>, the only variables that are usable are the ones
from the <\s-1TMPL_LOOP\s0>. The variables in the outer blocks are not
visible within a template loop. For the computer-science geeks among
you, a <\s-1TMPL_LOOP\s0> introduces a new scope much like a perl subroutine
call. If you want your variables to be global you can use
\&'global_vars' option to \fBnew()\fR described below.
.SS "\s-1TMPL_INCLUDE\s0"
.IX Subsection "TMPL_INCLUDE"
.Vb 2
\&
\&
.Ve
.PP
This tag includes a template directly into the current template at the
point where the tag is found. The included template contents are used
exactly as if its contents were physically included in the master
template.
.PP
The file specified can be an absolute path (beginning with a '/' under
Unix, for example). If it isn't absolute, the path to the enclosing
file is tried first. After that the path in the environment variable
\&\s-1HTML_TEMPLATE_ROOT\s0 is tried, if it exists. Next, the \*(L"path\*(R" option is
consulted, first as-is and then with \s-1HTML_TEMPLATE_ROOT\s0 prepended if
available. As a final attempt, the filename is passed to \fBopen()\fR
directly. See below for more information on \s-1HTML_TEMPLATE_ROOT\s0 and
the \*(L"path\*(R" option to \fBnew()\fR.
.PP
As a protection against infinitly recursive includes, an arbitrary
limit of 10 levels deep is imposed. You can alter this limit with the
\&\*(L"max_includes\*(R" option. See the entry for the \*(L"max_includes\*(R" option
below for more details.
.PP
For the <\s-1TMPL_INCLUDE\s0 EXPR=\*(L"..\*(R"> see \*(L"\s-1INCLUDE\s0 extension to Expr\*(R"
for more details.
.SS "\s-1TMPL_IF\s0"
.IX Subsection "TMPL_IF"
.Vb 1
\& ...
.Ve
.PP
The <\s-1TMPL_IF\s0> tag allows you to include or not include a block of the
template based on the value of a given parameter name. If the
parameter is given a value that is true for Perl \- like '1' \- then the
block is included in the output. If it is not defined, or given a
false value \- like '0' \- then it is skipped. The parameters are
specified the same way as with \s-1TMPL_VAR.\s0
.PP
Example Template:
.PP
.Vb 3
\&
\& Some text that only gets displayed if BOOL is true!
\&
.Ve
.PP
Now if you call \f(CW$template\fR\->param(\s-1BOOL\s0 => 1) then the above block will
be included by output.
.PP
<\s-1TMPL_IF\s0> blocks can include any valid HTML::Template
construct \- VARs and LOOPs and other \s-1IF/ELSE\s0 blocks. Note, however,
that intersecting a <\s-1TMPL_IF\s0> and a <\s-1TMPL_LOOP\s0> is invalid.
.PP
.Vb 5
\& Not going to work:
\&
\&
\&
\&
.Ve
.PP
If the name of a \s-1TMPL_LOOP\s0 is used in a \s-1TMPL_IF,\s0 the \s-1IF\s0 block will
output if the loop has at least one row. Example:
.PP
.Vb 3
\&
\& This will output if the loop is not empty.
\&
\&
\&
\& ....
\&
.Ve
.PP
\&\s-1WARNING:\s0 Much of the benefit of HTML::Template is in decoupling your
Perl and \s-1HTML.\s0 If you introduce numerous cases where you have
TMPL_IFs and matching Perl \fBif()\fRs, you will create a maintenance
problem in keeping the two synchronized. I suggest you adopt the
practice of only using \s-1TMPL_IF\s0 if you can do so without requiring a
matching \fBif()\fR in your Perl code.
.SS "\s-1TMPL_ELSIF\s0"
.IX Subsection "TMPL_ELSIF"
.Vb 4
\& ...
\& ...
\& ...
\& ...
.Ve
.PP
\&\s-1WARNING: TMPL_ELSIF\s0 is a HTML::Template::Pro extension! It is
not supported in HTML::Template (as of 2.9).
.SS "\s-1TMPL_ELSE\s0"
.IX Subsection "TMPL_ELSE"
.Vb 1
\& ... ...
.Ve
.PP
You can include an alternate block in your \s-1TMPL_IF\s0 block by using
\&\s-1TMPL_ELSE.\s0 \s-1NOTE:\s0 You still end the block with , not
!
.PP
.Vb 1
\& Example:
\&
\&
\& Some text that is included only if BOOL is true
\&
\& Some text that is included only if BOOL is false
\&
.Ve
.SS "\s-1TMPL_UNLESS\s0"
.IX Subsection "TMPL_UNLESS"
.Vb 1
\& ...
.Ve
.PP
This tag is the opposite of <\s-1TMPL_IF\s0>. The block is output if the
\&\s-1CONTROL_PARAMETER\s0 is set false or not defined. You can use
<\s-1TMPL_ELSE\s0> with <\s-1TMPL_UNLESS\s0> just as you can with <\s-1TMPL_IF\s0>.
.PP
.Vb 1
\& Example:
\&
\&
\& Some text that is output only if BOOL is FALSE.
\&
\& Some text that is output only if BOOL is TRUE.
\&
.Ve
.PP
If the name of a \s-1TMPL_LOOP\s0 is used in a \s-1TMPL_UNLESS,\s0 the \s-1UNLESS\s0 block
output if the loop has zero rows.
.PP
.Vb 3
\&
\& This will output if the loop is empty.
\&
\&
\&
\& ....
\&
.Ve
.SS "\s-1NOTES\s0"
.IX Subsection "NOTES"
HTML::Template's tags are meant to mimic normal \s-1HTML\s0 tags. However,
they are allowed to \*(L"break the rules\*(R". Something like:
.PP
.Vb 1
\&
.Ve
.PP
is not really valid \s-1HTML,\s0 but it is a perfectly valid use and will
work as planned.
.PP
The \*(L"NAME=\*(R" in the tag is optional, although for extensibility's sake I
recommend using it. Example \- \*(L"<\s-1TMPL_LOOP LOOP_NAME\s0>\*(R" is acceptable.
.PP
If you're a fanatic about valid \s-1HTML\s0 and would like your templates
to conform to valid \s-1HTML\s0 syntax, you may optionally type template tags
in the form of \s-1HTML\s0 comments. This may be of use to \s-1HTML\s0 authors who
would like to validate their templates' \s-1HTML\s0 syntax prior to
HTML::Template processing, or who use DTD-savvy editing tools.
.PP
.Vb 1
\&
.Ve
.PP
In order to realize a dramatic savings in bandwidth, the standard
(non-comment) tags will be used throughout this documentation.
.SH "EXPR EXTENSION"
.IX Header "EXPR EXTENSION"
This module supports an extension to HTML::Template which allows
expressions in the template syntax which was implemented in
HTML::Template::Expr. See HTML::Template::Expr for details.
.PP
Expression support includes comparisons, math operations, string
operations and a mechanism to allow you add your own functions at
runtime. The basic syntax is:
.PP
.Vb 3
\&
\& I\*(Aqve got a lot of bananas.
\&
.Ve
.PP
This will output \*(L"I've got a lot of bananas\*(R" if you call:
.PP
.Vb 1
\& $template\->param(banana_count => 100);
.Ve
.PP
In your script. <\s-1TMPL_VAR\s0>s also work with expressions:
.PP
.Vb 1
\& I\*(Aqd like to have bananas.
.Ve
.PP
This will output \*(L"I'd like to have 200 bananas.\*(R" with the same \fBparam()\fR
call as above.
.SH "BASIC SYNTAX"
.IX Header "BASIC SYNTAX"
.SS "Variables"
.IX Subsection "Variables"
Variables are unquoted alphanumeric strings with the same restrictions
as variable names in HTML::Template. Their values are set through
\&\fBparam()\fR, just like normal HTML::Template variables. For example,
these two lines are equivalent:
.PP
.Vb 1
\&
\&
\&
.Ve
.SS "Emiliano Bruni extension to Expr"
.IX Subsection "Emiliano Bruni extension to Expr"
original HTML::Template allows almost arbitrary chars in parameter names,
but original HTML::Template::Expr (as to 0.04) allows variables in the
\&'\s-1EXPR\s0' tag to be only m![A\-Za\-z_][A\-Za\-z0\-9_]*!.
.PP
With this extension, arbitrary chars can be used in variable name inside
the '\s-1EXPR\s0' tag if bracketed in ${}, as, for example, EXPR=\*(L"${foo.bar} eq 'a'\*(R".
Note that old bracketing into {} is considered obsolete, as it will clash
with \s-1JSON\s0 assignments like A = { \*(L"key\*(R" => \*(L"val\*(R" }.
.PP
\&\s-1COMPATIBILITY WARNING.\s0
Currently, this extension is not present in HTML::Template::Expr (as of 0.04).
.SS "\s-1INCLUDE\s0 extension to Expr"
.IX Subsection "INCLUDE extension to Expr"
With this extension, you can write something like <\s-1TMPL_INCLUDE\s0 EXPR=\*(L"variable\*(R">
or <\s-1TMPL_INCLUDE\s0 EXPR=\*(L"\fBfunction_call()\fR\*(R">, or even
<\s-1TMPL_INCLUDE\s0 EXPR=\*(L"function_call(\s-1VAR1,VAR2\s0,\fBfunc2()\fR) DEFAULT='some_file'\*(R">
.PP
\&\s-1SECURITY WARNING.\s0
Using of this extension with untrasted values of variables is a
potential security leak (as in <\s-1TMPL_INCLUDE\s0 EXPR=\*(L"\s-1USER_INPUT\*(R"\s0>
with USER_INPUT='/etc/passwd').
Omit it unless you know what you are doing.
.PP
\&\s-1COMPATIBILITY WARNING.\s0
Currently, this extension is not present in HTML::Template::Expr (as of 0.04).
.SS "Constants"
.IX Subsection "Constants"
Numbers are unquoted strings of numbers and may have a single \*(L".\*(R" to
indicate a floating point number. For example:
.PP
.Vb 1
\&
.Ve
.PP
String constants must be enclosed in quotes, single or double. For example:
.PP
.Vb 1
\&
.Ve
.PP
Note that the original parser of HTML::Template::Expr is currently (0.04)
rather simple, so if you need backward compatibility all compound
expressions must be parenthesized.
.PP
Backward compatible examples:
.PP
.Vb 1
\&
\&
\&
.Ve
.PP
Nevertheless, in HTML::Template::Pro, you can safely write things like
.PP
.Vb 1
\&
.Ve
.PP
with proper priority of operations.
.PP
Pattern in a regular expression must be enclosed with \*(L"/\*(R":
.PP
.Vb 1
\&
.Ve
.SH "COMPARISON"
.IX Header "COMPARISON"
Here's a list of supported comparison operators:
.IP "\(bu" 4
Numeric Comparisons
.RS 4
.IP "\(bu" 4
<
.IP "\(bu" 4
>
.IP "\(bu" 4
==
.IP "\(bu" 4
!=
.IP "\(bu" 4
>=
.IP "\(bu" 4
<=
.IP "\(bu" 4
<=>
.RE
.RS 4
.RE
.IP "\(bu" 4
String Comparisons
.RS 4
.IP "\(bu" 4
gt
.IP "\(bu" 4
lt
.IP "\(bu" 4
eq
.IP "\(bu" 4
ne
.IP "\(bu" 4
ge
.IP "\(bu" 4
le
.IP "\(bu" 4
cmp
.RE
.RS 4
.RE
.SH "MATHEMATICS"
.IX Header "MATHEMATICS"
The basic operators are supported:
.IP "\(bu" 4
+
.IP "\(bu" 4
\&\-
.IP "\(bu" 4
*
.IP "\(bu" 4
/
.IP "\(bu" 4
%
.IP "\(bu" 4
^ (not supported in HTML::Template::Expr)
.PP
There are also some mathy functions. See the \s-1FUNCTIONS\s0 section below.
.SH "LOGIC"
.IX Header "LOGIC"
Boolean logic is available:
.IP "\(bu" 4
&& (synonym: and)
.IP "\(bu" 4
|| (synonym: or)
.SH "REGULAR EXPRESSION SUPPORT"
.IX Header "REGULAR EXPRESSION SUPPORT"
regexp support is added to HTML::Template::Expr and
HTML::Template::Pro by Stanislav Yadykin .
Currently it is not included in official distribution of HTML::Template::Expr.
.PP
Standard regexp syntax:
.IP "\(bu" 4
=~
.IP "\(bu" 4
!~
.SH "FUNCTIONS"
.IX Header "FUNCTIONS"
The following functions are available to be used in expressions. See
perldoc perlfunc for details.
.IP "\(bu" 4
sprintf
.IP "\(bu" 4
substr (2 and 3 arg versions only)
.IP "\(bu" 4
lc
.IP "\(bu" 4
lcfirst
.IP "\(bu" 4
uc
.IP "\(bu" 4
ucfirst
.IP "\(bu" 4
length
.IP "\(bu" 4
defined
.IP "\(bu" 4
abs
.IP "\(bu" 4
atan2
.IP "\(bu" 4
cos
.IP "\(bu" 4
exp
.IP "\(bu" 4
hex
.IP "\(bu" 4
int
.IP "\(bu" 4
log
.IP "\(bu" 4
oct
.IP "\(bu" 4
rand
.IP "\(bu" 4
sin
.IP "\(bu" 4
sqrt
.IP "\(bu" 4
srand
.PP
All functions must be called using full parenthesis. For example,
this is a syntax error:
.PP
.Vb 1
\&
.Ve
.PP
But this is good:
.PP
.Vb 1
\&
.Ve
.SH "EXPR: DEFINING NEW FUNCTIONS"
.IX Header "EXPR: DEFINING NEW FUNCTIONS"
You may also define functions of your own.
See HTML::Template::PerlInterface for details.
.SH "AUTHOR"
.IX Header "AUTHOR"
Sam Tregar, sam@tregar.com (Main text)
.PP
I. Vlasenko, (Pecularities of HTML::Template::Pro)
.SH "LICENSE"
.IX Header "LICENSE"
.Vb 2
\& HTML::Template : A module for using HTML Templates with Perl
\& Copyright (C) 2000\-2008 Sam Tregar (sam@tregar.com)
\&
\& This module is free software; you can redistribute it and/or modify it
\& under the terms of either:
\&
\& a) the GNU General Public License as published by the Free Software
\& Foundation; either version 2, or (at your option) any later version,
\&
\& or
\&
\& b) the "Artistic License" which comes with this module.
\&
\& This program is distributed in the hope that it will be useful,
\& but WITHOUT ANY WARRANTY; without even the implied warranty of
\& MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See either
\& the GNU General Public License or the Artistic License for more details.
\&
\& You should have received a copy of the Artistic License with this
\& module, in the file ARTISTIC. If not, I\*(Aqll be glad to provide one.
\&
\& You should have received a copy of the GNU General Public License
\& along with this program; if not, write to the Free Software
\& Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111\-1307
\& USA
.Ve