NAME

CGI::Application::Plugin::TT::Any - load CGI::Application::Plugin::TT with any TT-compatible class

VERSION

version 0.110080

SYNOPSIS

use strict;
use warnings;

package MyCGIApp;

use base qw(CGI::Application);
use CGI::Application::Plugin::TT;
use CGI::Application::Plugin::TT::Any;

sub setup {
    my ( $self ) = @_;
    $self->tt_config(
        TEMPLATE_OPTIONS => {
            CLASS => 'Template::AutoFilter',
            INCLUDE_PATH => 't',
        },
    );
}

sub myrunmode {
    my ( $self ) = @_;
    my %params = ( email => 'email@company.com' );
    return $self->tt_process( 'template.tmpl', \%params );
}

Alternatively:

use strict;
use warnings;

package MyCGIApp;

use base qw(CGI::Application);
use CGI::Application::Plugin::TT;

use CGI::Application::Plugin::TT::Any (
    TEMPLATE_OPTIONS => {
        CLASS => 'Template::AutoFilter',
        INCLUDE_PATH => 't',
    },
);

sub myrunmode {
    my ( $self ) = @_;
    my %params = ( email => 'email@company.com' );
    return $self->tt_process( 'template.tmpl', \%params );
}

METHODS

tt_obj

Overrides CGI::Application::Plugin::TT's tt_obj() with a version that inspects the CLASS field of the TEMPLATE_OPTIONS hashref in the options and, if set, loads the Template object using that class. Otherwise it defaults to Template.

AUTHOR

Christian Walde <walde.christian@googlemail.com>

COPYRIGHT AND LICENSE

This software is Copyright (c) 2011 by Christian Walde.

This is free software, licensed under:

DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE, Version 2, December 2004