Catalyst::View::MicroMason - MicroMason View Class
Use the helper:
script/create.pl view MicroMason MicroMason
To create a simple View subclass:
# lib/MyApp/View/MicroMason.pm package MyApp::View::MicroMason; use base 'Catalyst::View::MicroMason'; 1;
And configure it in your app's config:
MyApp->config->{View::MicroMason} = { # -Filters : to use |h and |u # -ExecuteCache : to cache template output # -CompileCache : to cache the templates Mixins => [qw( -Filters -CompileCache )], INCLUDE_PATH => '/path/to/comp_root' };
In an 'end' action:
$c->view('MicroMason')->template('foo.mc'); $c->forward('MyApp::View::MicroMason');
Or perhaps:
my $output = $c->view('MicroMason')->render('foo.mc');
Want to use a MicroMason component in your views? No problem! Catalyst::View::MicroMason comes to the rescue.
Create an instance; should be called from COMPONENT, not by you.
COMPONENT
Renders the component specified in $c->stash->{template} or by the value $c->action (if $c->stash->{template} is undefined). See Catalyst::View::Templated for all the details.
MicroMason global variables $base, $c (or whatever you pass in at config time as CATALYST_VAR) and c<$name> are automatically set to the base, context and name of the app, respectively.
$base
$c
An exception is thrown if processing fails, otherwise the output is stored in $c->response->body.
$c->response->body
Renders the given template and returns output.
Throws an exception on error. If $template is not defined, it is determined by calling $self->template. See Catalyst::View::Templated for details.
$template
$self->template
Catalyst, Catalyst::View::Templated, Text::MicroMason, Catalyst::View::Mason
Jonas Alves <jgda@cpan.org>
<jgda@cpan.org>
The Catalyst Core Team http://www.catalystframework.org
Jonathan Rockway <jrockway@cpan.org>
<jrockway@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.