---
name: "Template::Alloy::Tmpl"
section: "3pm"
platform: "linux"
package: "libtemplate-alloy-perl"
version: "1.022-3"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/Template::Alloy::Tmpl"
---

# Template::Alloy::Tmpl(3pm)

Text::Tmpl role

## NAME

Template::Alloy::Tmpl - Text::Tmpl role

## DESCRIPTION

The Template::Alloy::Tmpl role provides the syntax and the interface for Text::Tmpl.  It also brings many of the features from the various templating systems.

See the Template::Alloy documentation for configuration and other parameters.

## ROLE\_METHODS

- "parse\_tree\_tmpl"

  Called by parse\_tree when syntax is set to tmpl.  Parses for tags Text::Tmpl style.

- "set\_delimiters"

  Sets the START\_TAG and END\_TAG to use for parsing.

  ```
      $obj->set_delimiters('#[', ']#');
  ```

- "strerror"

  Can be used for checking the error when compile fails (or you can use -\>error). May be called as function or method (Text::Tmpl only allows as function).

- "set\_strip"

  Determines if trailing whitespace on same line is removed.  Default is false.

- "set\_dir"

  Sets the path to look for included templates in.

- "set\_value"

  Sets a single value that will be used during processing of the template.

  ```
      $obj->set_value(key => $value);
  ```

- "set\_values"

  Sets multiple values for use during processing.

  ```
      $obj->set_values(\%values);
  ```

- "parse\_string"

  Processes the passed string.

  ```
      my $out = $obj->process_string("#[echo $foo]#");
  ```

- "parse\_file"

  Processes the passed filename.

  ```
      my $out = $obj->process_file("my/file.tmpl");
  ```

- "loop\_iteration"

  Same as the Text::Tmpl method - used for adding iterations to a loop.

  ```
      my $ref = $obj->loop_iteration('loop1'); # creates iteration 0
      $ref->set_values($hash);
  ```

- "fetch\_loop\_iteration"

  Gets a previously created loop iteration.

  ```
      my $ref = $obj->fetch_loop_iteration('loop1', 0);
      $ref->set_values($hash);
  ```

## UNSUPPORTED Text::Tmpl METHODS

register\_simple, register\_pair, alias\_simple, alias\_pair, remove\_simple, remove\_pair, set\_debug, errno

## AUTHOR

Paul Seamons \<paul@seamons.com\>

## LICENSE

This module may be distributed under the same terms as Perl itself.
