Search code examples
perltemplate-toolkit

Evaluation of Template Toolkit code samples


I'd like to be able to check simple Template code samples, so I do the following:

perl -we 'use Template; Template->new->process (\"...", {});'

But I'm a bit tired of typing this all over again. Is there a "well-known" tool for this?


Solution

  • It looks like tpage, a script included in the Template::Toolkit distribution, does this. From the documentation:

    The tpage script is a simple wrapper around the Template Toolkit processor. Files specified by name on the command line are processed in turn by the template processor and the resulting output is sent to STDOUT and can be redirected accordingly.

    You can set global configuration options in a .tpagerc file in your home directory. These options will be applied every time tpage is run.