Template::Manual::Directives

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

Template::Manual::Directives Ranking & Summary

Advertisement

  • Rating:
  • License:
  • Perl Artistic License
  • Price:
  • FREE
  • Publisher Name:
  • Andy Wardley
  • Publisher web site:
  • http://search.cpan.org/~abw/

Template::Manual::Directives Tags


Template::Manual::Directives Description

Template::Manual::Directives is a Perl module that contains template directives. Template::Manual::Directives is a Perl module that contains template directives.Accessing and Updating Template VariablesGETThe GET directive retrieves and outputs the value of the named variable. The GET keyword is optional. A variable can be specified in a directive tag by itself. The variable can have an unlimited number of elements, each separated by a dot '.'. Each element can have arguments specified within parentheses. ...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). 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. # 2.5 # 2 # 3CALLThe CALL directive is similar to GET in evaluating the variable named, but doesn't 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 aren't interested in the value returned. SETThe SET directive allows you to assign new values to existing variables or create new temporary variables. The SET keyword is also optional. 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. # literal value 'Foo' # value of variable 'foo' # literal value '$100' # 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: Simple expressions can also be used, as per GET. 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: You can, of course, achieve a similar effect with double quoted string interpolation. DEFAULTThe DEFAULT directive is similar to SET but only updates variables that are currently undefined or have no "true" value (in the Perl sense). This can be particularly useful in common template components to ensure that some sensible default are provided for otherwise undefined variables. < html> < head> < title> < /head> < body bgcolor="">Requirements:· Perl Requirements: · Perl


Template::Manual::Directives Related Software