Scroll to navigation

Sympa::Template(3Sympa) sympa 6.2.58 Sympa::Template(3Sympa)


Sympa::Template - Template parser


  use Sympa::Template;
  $template = Sympa::Template->new;
  $template->parse($data, $tpl_file, \$output);



Constructor. Creates new Sympa::Template instance.


Context. Site, Robot or List.
Pairs to specify property defaults.
Instance method. Parses template and outputs result.


A HASH ref containing the data.
A string that contains the file name. Or, scalarref or arrayref that contains the template.
A file descriptor or a reference to scalar for the output.
If 1 is set, prepended header fields are assumed, i.e. one newline will be inserted at beginning of output.
This option was obsoleted.


On success, returns 1 and clears {last_error} property. Otherwise returns "undef" and sets {last_error} property.


Instance of Sympa::Template may have following attributes.

If set, absolute paths in "INCLUDE" directive are allowed.
Reference to array containing additional template search paths.
Read only. Error occurred at the last execution of parse, or "undef".
{subdir}, {lang}, {lang_only}


These custom filters are defined by Sympa::Template. See Template::Manual::Filters about usage of filters.

Canonicalize e-mail address.

This filter was added by Sympa 6.2.17.

No longer used.
No longer used.
Applies C-style escaping of a string (not enclosed by quotes).

This filter was added on Sympa 6.2.37b.1.

Escape quotation marks.

Deprecated. Use escape_cstr.

Escapes URL.

This was OBSOLETED. Use "mailtourl" instead.

OBSOLETED. Use "xml" in Template::Manual::Filters.
Translates text using catalog. Placeholders (%1, %2, ...) are replaced by parameters.
Generates formatted (i18n'ized) date/time.
strftime() style format string.
A string representing date/time: "YYYY/MM", "YYYY/MM/DD", "YYYY/MM/DD/HH/MM" or "YYYY/MM/DD/HH/MM/SS".
Generates mailbox string appropriately encoded to suit for addresses in header fields.
Display name, if any.
E-mail address.
Comment, if any.

This filter was introduced on Sympa 6.2.42.

Generates HTML fragment linking to "mailto:" URL, i.e. "<a href="mailto:email">filtered text</a>".
Content of linking element. If it does not contain nonspaces, e-mail address will be used.
E-mail address(es) to be linked.
{key => val, ...}
Optional query.
If true, assumes arguments are not encoded as HTML entities. By default entities are decoded at first.

This option does not affect filtered text.

Note: This filter was introduced by Sympa 6.2.14.

Generates "mailto:" URL.
E-mail address(es). Note that any characters must not be encoded as HTML entities.
{key = val, ...}
Optional query. Note that any characters must not be encoded as HTML entities.

Note: This filter was introduced by Sympa 6.2.14.

Obfuscates email addresses in the HTML text according to mode.
HTML document or fragment.
Obfuscation mode. "at" or "javascript". Invalid mode will be silently ignored.

Note: This filter was introduced by Sympa 6.2.14.

Generates i18n'ed description of list parameter value.

As of Sympa 6.2.17, if it is called by the web templates (in "web_tt2" subdirectories), special characters in result will be encoded.

Parameter value.
Type of list parameter value: Special types (See "field_type" in Sympa::ListDef) or others (default).
If parameter value is added to the description. False by default.
Encode string by MIME header encoding. Despite its name, appropriate encoding scheme ("Q" or "B") will be chosen.
No longer used.
Same as "url_rel" but gives absolute URI.

Note: This filter was introduced by Sympa 6.2.15.

Gives relative URI for specified action.

If it is called by the web templates (in "web_tt2" subdirectories), HTML entities in the arguments will be decoded and special characters in resulting URL will be encoded.

Name of action.
Array. Additional path components.
Hash. Optional query.
Scalar. Optional fragment.

Note: This filter was introduced by Sympa 6.2.15.

Generates folded text.
Indentation (or its length) of each paragraph if any.
Indentation (or its length) of other lines if any.
Line width, defaults to 78.


Calls of "helploc", "loc" and "locdt" in template files are extracted during packaging process and are added to translation catalog.


Plugins may be placed under LIBDIR/Sympa/Template/Plugin. See <> about usage of plugins.




Sympa 4.2b.3 adopted template engine based on Template Toolkit.

Plugin feature was added on Sympa 6.2.

tt2 module was renamed to Sympa::Template on Sympa 6.2.

2020-12-30 6.2.58