The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Kelp::Module::Template::Toolkit - Template::Toolkit processing for Kelp applications

SYNOPSIS

First ...

    # conf/config.pl
    {
        modules => ['Template::Toolkit'],
        modules_init => {
            'Template::Toolkit' => { ... }
        }
    };

Then ...

    # lib/MyApp.pm
    sub some_route {
        my $self = shift;
        $self->template('some_template', { bar => 'foo' });
    }

DESCRIPTION

This module provides an interface for using Template inside a Kelp web application.

REGISTERED METHODS

template

template($filename, \%vars)

Renders a file using the currently loaded template engine.

PERKS

UTF8

Template is sometimes unable to detect the correct encoding, so to ensure proper rendering, you may want to add ENCODING to its configuration. If your templates are in the views folder (default location generated by Kelp), you should also add this location to the config:

    # conf/config.pl
    {
        modules      => ['Template::Toolkit'],
        modules_init => {
            'Template::Toolkit' => {
                ENCODING => 'utf8',
                INCLUDE_PATH => [qw{./views/}],
                RELATIVE => 1
            }
        }
    };

You can now render a template stored in home.tt and correctly encoded like this:

    $self->render('home'); # can drop extension if tt

AUTHOR

Stefan Geneshky - minimal @ cpan . org

CONTRIBUTORS

Gurunandan Bhat - gbhat @ pobox . com

LICENSE

Perl