Catalyst::View::HTML::Mason - HTML::Mason rendering for Catalyst
version 0.01
package MyApp::View::Mason; use Moose; use namespace::autoclean; extends 'Catalyst::View::HTML::Mason'; __PACKAGE__->config( interp_args => { comp_root => MyApp->path_to('root'), }, ); 1;
This module provides rendering of HTML::Mason templates for Catalyst applications.
It's basically a rewrite of Catalyst::View::Mason, which became increasingly hard to maintain over time, while keeping backward compatibility.
The mason interpreter instance responsible for rendering templates.
The class the interp instance is constructed from. Defaults to HTML::Mason::Interp.
interp
HTML::Mason::Interp
Arguments to be passed to the construction of interp. Defaults to an empty hash reference.
File extension to be appended to every component file. By default it's only appended if no explicit component file has been provided in $ctx->stash->{template}.
$ctx->stash->{template}
If this is set to a true value, template_extension will also be appended to component paths provided in $ctx->stash->{template}.
template_extension
Encode Mason output with the given encoding. Can be a string encoding name (which will be resolved using Encode::find_encoding()), or an Encode::Encoding object. See Encode::Supported for a list of encodings.
Arrayref of string names to export into each rendered component. Off by default.
Example:
globals => [qw[ $foo %bar ]]
Would export $foo and %bar to every Mason component as globals using identically-named values in the stash, similar to:
our $foo = $c->stash->{foo}; our %bar = %{ $c->stash->{bar} };
To export the context as $c, one would set globals => ['$c'] and make sure to set $c->stash->{c} = $c on each request, such as in an auto in the root controller.
auto
Florian Ragwitz <rafl@debian.org> Sebastian Willert <willert@cpan.org> Robert Buels <rbuels@cpan.org>
This software is copyright (c) 2010 by Florian Ragwitz.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
To install Catalyst::View::HTML::Mason, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Catalyst::View::HTML::Mason
CPAN shell
perl -MCPAN -e shell install Catalyst::View::HTML::Mason
For more information on module installation, please visit the detailed CPAN module installation guide.