NAME
Egg::View::HT - View for HTML::Template.
SYNOPSIS
__PACKAGE__->egg_startup(
.....
...
VIEW => [
[ Template => {
path => [qw{ <$e.template> <$e.comp> }],
cache => 1,
global_vars => 1,
die_on_bad_params => 0,
... etc.
} ],
],
);
# The VIEW object is acquired.
my $view= $e->view('HT');
# Associate is set.
$view->push_associate( $object );
# Filter is set.
$view->push_filter( $filter );
# It outputs it specifying the template.
my $content= $view->render('hoge.tmpl', \%option);
DESCRIPTION
HTML::Template it is a view to drink and to use the template.
Please add HT to the setting of VIEW to make it use.
VIEW => [
[ HT => { ... HTML::Template option. (HASH) } ],
],
HANDLER METHODS
Egg::View has been succeeded to.
new
Constructor.
Egg::View::Template::GlobalParam is set up.
The object and $e->request of associate are set.
my $view= $e->view('HT');
push_filter ([FILTER])
FILTER is added to filter.
$view->push_filter(sub { ... filter code });
push_associate ([CONTEXT])
CONTEXT is added to associate.
$view->push_associate($context);
render ([TEMPLATE_STR], [OPTION])
It is HTML::Template as for the template of TEMPLATE_STR. The result of evaluating is returned by the SCALAR reference.
OPTION is HTML::Template. It is an option to pass. OPTION overwrites a set value of the configuration.
my $body= $view->render( 'foo.tt',
..........
....
);
output ([TEMPLATE_STR], [OPTION])
The result of the render method is set in $e->response->body.
When TEMPLATE is omitted, it acquires it from $view->template.
OPTION is passed to the render method as it is.
$view->output;
SEE ALSO
Egg::Release, Egg::View, Egg::View::Template::GlobalParam, HTML::Template,
AUTHOR
Masatoshi Mizuno <lushe@cpan.org>
COPYRIGHT AND LICENSE
Copyright (C) 2008 Bee Flag, Corp. <http://egg.bomcity.com/>.
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.