CGI::Application::Plugin::TT::Any - load CGI::Application::Plugin::TT with any TT-compatible class
version 0.110080
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 ); }
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.
Christian Walde <walde.christian@googlemail.com>
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
To install CGI::Application::Plugin::TT::Any, copy and paste the appropriate command in to your terminal.
cpanm
cpanm CGI::Application::Plugin::TT::Any
CPAN shell
perl -MCPAN -e shell install CGI::Application::Plugin::TT::Any
For more information on module installation, please visit the detailed CPAN module installation guide.