Main > Programming > Libraries >

Template::Manual::Directives 2.19

Template::Manual::Directives 2.19

Sponsored Links

Template::Manual::Directives 2.19 Ranking & Summary

RankingClick at the star to rank
Ranking Level
User Review: 0 (0 times)
File size: 0.76 MB
Platform: Any Platform
License: Perl Artistic License
Price:
Downloads: 836
Date added: 2007-07-11
Publisher: Andy Wardley

Template::Manual::Directives 2.19 description

Template::Manual::Directives is a Perl module that contains template directives.

Accessing and Updating Template Variables

GET

The GET directive retrieves and outputs the value of the named variable.

[% GET foo %]

The GET keyword is optional. A variable can be specified in a directive tag by itself.

[% foo %]

The variable can have an unlimited number of elements, each separated by a dot .. Each element can have arguments specified within parentheses.

[% foo %]
[% bar.baz %]
[% biz.baz(10) %]
...etc...

See Template::Manual::Variables for a full discussion on template variables.
You can also specify expressions using the logical (and, or, not, ?:) and mathematic operators (+ - * / % mod div).

[% template.title or default.title %]

[% score * 100 %]

[% order.nitems ? checkout(order.total) : no items %]

The div operator returns the integer result of division. Both % and mod return the modulus (i.e. remainder) of division. mod is provided as an alias for % for backwards compatibility with version 1.

[% 15 / 6 %] # 2.5
[% 15 div 6 %] # 2
[% 15 mod 6 %] # 3

CALL

The CALL directive is similar to GET in evaluating the variable named, but doesnt print the result returned. This can be useful when a variable is bound to a sub-routine or object method which you want to call but arent interested in the value returned.

[% CALL dbi.disconnect %]

[% CALL inc_page_counter(page_count) %]

SET

The SET directive allows you to assign new values to existing variables or create new temporary variables.

[% SET title = Hello World %]

The SET keyword is also optional.

[% title = Hello World %]

Variables may be assigned the values of other variables, unquoted numbers (digits), literal text (single quotes) or quoted text ("double quotes"). In the latter case, any variable references within the text will be interpolated when the string is evaluated. Variables should be prefixed by $, using curly braces to explicitly scope the variable name where necessary.

[% foo = Foo %] # literal value Foo
[% bar = foo %] # value of variable foo
[% cost = $100 %] # literal value $100
[% item = "$bar: ${cost}.00" %] # value "Foo: $100.00"

Multiple variables may be assigned in the same directive and are evaluated in the order specified. Thus, the above could have been written:

[% foo = Foo
bar = foo
cost = $100
item = "$bar: ${cost}.00"
%]

Simple expressions can also be used, as per GET.

[% ten = 10
twenty = 20
thirty = twenty + ten
forty = 2 * twenty
fifty = 100 div 2
six = twenty mod 7
%]

You can concatenate strings together using the _ operator. In Perl 5, the . is used for string concatenation, but in Perl 6, as in the Template Toolkit, the . will be used as the method calling operator and _ will be used for string concatenation. Note that the operator must be specified with surrounding whitespace which, as Larry says, is construed as a feature:

[% copyright = (C) Copyright _ year _ _ author %]

You can, of course, achieve a similar effect with double quoted string interpolation.

[% copyright = "(C) Copyright $year $author" %]

DEFAULT

The DEFAULT directive is similar to SET but only updates variables that are currently undefined or have no "true" value (in the Perl sense).

[% DEFAULT
name = John Doe
id = jdoe
%]

This can be particularly useful in common template components to ensure that some sensible default are provided for otherwise undefined variables.

[% DEFAULT
title = Hello World
bgcol = #ffffff
%]
< html>
< head>
< title>[% title %]
< /head>

< body bgcolor="[% bgcol %]">

Template::Manual::Directives 2.19 Screenshot

Advertisements

Template::Manual::Directives 2.19 Keywords

Bookmark Template::Manual::Directives 2.19

Hyperlink code:
Link for forum:

Template::Manual::Directives 2.19 Copyright

WareSeeker periodically updates pricing and software information of Template::Manual::Directives 2.19 full version from the publisher, so some information may be slightly out-of-date. You should confirm all information before relying on it. Software piracy is theft, Using crack, password, serial numbers, registration codes, key generators is illegal and prevent future development of Template::Manual::Directives 2.19 Edition. Download links are directly from our publisher sites, torrent files or links from rapidshare.com, yousendit.com or megaupload.com are not allowed

Allok Video Splitter 2.2.0 Review:

Name (Required)
Email(Required)
Captcha
Featured Software

Want to place your software product here?
Please contact us for consideration.

Contact WareSeeker.com
Related Software
Template::Manual::Plugins is Perl module for standard plugins. Free Download
Template::Plugins is a Perl module with plugin provider module. Free Download
Template::Tutorial::Datafile is a Perl module for creating Data Output Files Using the Template Toolkit. Free Download
Template::Magic is a Perl module for magic merger of runtime values with templates. Free Download
Template::Tutorial::Web is a Perl module for generating web content using the template toolkit. Free Download
Template::FAQ contains Frequently Asked Questions about the Template Toolkit. Free Download
Maypole::Manual::View is a Perl module for Maypole View Classes. Free Download
Template::Multilingual is a Perl module with multilingual templates for Template Toolkit. Free Download