Catalyst::View::Mason - Mason View Class
# use the helper create.pl view Mason Mason # lib/MyApp/View/Mason.pm package MyApp::View::Mason; use base 'Catalyst::View::Mason'; __PACKAGE__->config->{DEBUG} = 'all'; __PACKAGE__->config->{comp_root} = '/path/to/comp_root'; __PACKAGE__->config->{data_dir} = '/path/to/data_dir'; 1; $c->forward('MyApp::View::Mason');
Want to use a Mason component in your views? No problem! Catalyst::View::Mason comes to the rescue.
You have to define comp_root and data_dir. If comp_root is not directly defined within config, the value comes from config-{root}>. If you don't define it at all, Mason is going to complain :) The default data_dir is /tmp.
comp_root
data_dir
config
config-
/tmp
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)
Mason 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 HTML::Mason::Interp->new constructor.
Catalyst, HTML::Mason, "Using Mason from a Standalone Script" in HTML::Mason::Admin
Andres Kievsky ank@cpan.org
ank@cpan.org
Based on the original Catalyst::View::TT code by:
Sebastian Riedel, sri@cpan.org Marcus Ramberg
sri@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::Mason, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Catalyst::View::Mason
CPAN shell
perl -MCPAN -e shell install Catalyst::View::Mason
For more information on module installation, please visit the detailed CPAN module installation guide.