NAME

Egg::View::TT - Template ToolKit for Egg View.

SYNOPSIS

__PACKAGE__->egg_startup(
  ...
  .....

VIEW=> [
  [ TT => {
     INCLUDE_PATH=> [qw( /path/to/root /path/to/comp )],
     TEMPLATE_EXTENSION=> '.tt',
     ... other Template ToolKit option.
     } ],
  ],

 );

# The VIEW object is acquired.
my $view= $e->view('TT');

# It outputs it specifying the template.
my $content= $view->render('hoge.tt', \%option);

DESCRIPTION

It is VIEW to use Template ToolKit.

Please add the setting of VIEW to the project to use it.

VIEW => [
  [ TT => { ... Template ToolKit option. (HASH) } ],
  ],

* Please refer to the document of Template for the option.

It accesses the object and data by using following variable from the template.

e ... Object of project.
s ... $e->stash.
p ... $e->view('Mason')->params.

METHODS

new

When $e->view('TT') is called, this constructor is called.

Please set %Egg::View::PARAMS directly from the controller to the parameter that wants to be set globally.

%Egg::View::PARAMS= %NewPARAM;

params, param

The parameter that wants to be passed to Template ToolKit must use these methods.

render ( [TEMPLATE], [OPTION] )

TEMPLATE is evaluated and the output result (SCALAR reference) is returned.

It is given priority more than set of default when OPTION is passed.

my $body= $view->render( 'foo.tt', [OPTION_HASH] );

output ( [TEMPLATE], [OPTION] )

The output result of the receipt from 'render' method is set in $e->response-> body.

When TEMPLATE is omitted, acquisition is tried from $view->template. see Egg::View.

If this VIEW operates as default_view, this method is called from '_dispatch_action' etc. by Egg.

$view->output;

reset

Template ToolKit made once uses as data of the object and is spent. Please pass render an arbitrary option after it resets it when you want the object in an option different from former in the scene that recurrently calls render.

SEE ALSO

http://www.template-toolkit.org/, Egg::View, Egg::Engine, Egg::Release,

AUTHOR

Masatoshi Mizuno, <lushe@cpan.org>

COPYRIGHT AND LICENSE

Copyright (C) 2007 Bee Flag, Corp. <http://egg.bomcity.com/>, All Rights Reserved.

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.6 or, at your option, any later version of Perl 5 you may have available.