NAME
Catalyst::View::MicroMason - MicroMason View Class
SYNOPSIS
# use the helper
script/create.pl view MicroMason MicroMason
# lib/MyApp/View/MicroMason.pm
package MyApp::View::MicroMason;
use base 'Catalyst::View::MicroMason';
__PACKAGE__->config(
# -Filters : to use |h and |u
# -ExecuteCache : to cache template output
# -CompileCache : to cache the templates
Mixins => [qw( -Filters -CompileCache )],
template_root => '/path/to/comp_root'
);
1;
# In an 'end' action
$c->forward('MyApp::View::MicroMason');
DESCRIPTION
Want to use a MicroMason component in your views? No problem! Catalyst::View::MicroMason comes to the rescue.
CAVEATS
You have to define template_root
. If template_root
is not directly defined within config
, the value comes from config-
{root}>. If you don't define it at all, MicroMason is going to use the root of your system.
METHODS
process
Renders the component specified in $c->stash->{template} or by the value $c->action (if $c->stash->{template} is undefined).
MicroMason global variables $base
, $c
and c<$name> are automatically set to the base, context and name of the app, respectively.
An exception is thrown if processing fails, otherwise the output is stored in $c->response->body
.
render($c, [$template])
Renders the given template and returns output. Throws an exception on error. If $template is not defined, the value of "template" from the stash is used instead.
SEE ALSO
Catalyst, Text::MicroMason, Catalyst::View::Mason
AUTHOR
Jonas Alves jgda@cpan.org
MAINTAINER
The Catalyst Core Team http://www.catalystframework.org
Jonathan Rockway <jrockway@cpan.org>
COPYRIGHT
This program is free software, you can redistribute it and/or modify it under the same terms as Perl itself.