Catalyst::View::MicroMason - MicroMason View Class
# 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; # Meanwhile, maybe in an 'end' action $c->forward('MyApp::View::MicroMason');
Want to use a MicroMason component in your views? No problem! Catalyst::View::MicroMason comes to the rescue.
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.
template_root
config
config-
Renders the component specified in $c->stash->{template} or $c->request->match to $c->response->output.
Note that the component name must be absolute, or is converted to absolute (ie, a / is added to the beginning if it doesn't start with one)
MicroMason global variables $base, $c and c<$name> are automatically set to the base, context and name of the app, respectively.
$base
$c
This allows your view subclass to pass additional settings to the Mason Text::MicroMason->new constructor.
Catalyst, Text::MicroMason
Jonas Alves jgda@cpan.org
jgda@cpan.org
This program is free software, you can redistribute it and/or modify it under the same terms as Perl itself.
To install Catalyst::View::MicroMason, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Catalyst::View::MicroMason
CPAN shell
perl -MCPAN -e shell install Catalyst::View::MicroMason
For more information on module installation, please visit the detailed CPAN module installation guide.