The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

App::TemplateEngine::TemplateToolkit - Interface for rendering HTML templates using the Template Toolkit

SYNOPSIS

    use App;

    $context = App->context();
    $template_engine = $context->service("TemplateEngine");  # or ...
    $template_engine = $context->template_engine();

    $template = "index.html";
    $text = $template_engine->render($template);

DESCRIPTION

A TemplateEngine Service is a means by which a template (such as an HTML template) may be rendered (with variables interpolated).

This implementation does the rendering using the Template Toolkit.

Class: App::TemplateEngine

 * Throws: App::Exception::TemplateEngine
 * Since:  0.01

A TemplateEngine Service is a means by which a template (such as an HTML template) may be rendered (with variables interpolated).

This implementation does the rendering using the Template Toolkit.

Constructor Methods:

new()

The constructor is inherited from App::Service.

Public Methods:

render()

    * Signature: $text = $template_engine->render($template);
    * Param:     $template          string
    * Return:    $text              text
    * Throws:    App::Exception::TemplateEngine
    * Since:     0.01

    Sample Usage:

    $text = $template_engine->render($template);

Protected Methods:

prepare_values()

    * Signature: $values = $template_engine->prepare_values();
    * Param:     void
    * Return:    $values            {}
    * Throws:    App::Exception::TemplateEngine
    * Since:     0.01

    Sample Usage:

    $values = $template_engine->prepare_values();

ACKNOWLEDGEMENTS

 * Author:  Stephen Adkins <spadkins@gmail.com>
 * License: This is free software. It is licensed under the same terms as Perl itself.

SEE ALSO

App::Context, App::Service