Catalyst::View::Mason2 - Mason 2.x view class
version 0.03
# use the helper script/create.pl view Mason2 Mason2 # lib/MyApp/View/Mason2.pm package MyApp::View::Mason2; use base 'Catalyst::View::Mason2'; __PACKAGE__->config( # insert Mason parameters here ); 1; # in a controller package MyApp::Controller::Foo; sub bar : Local { ... $c->stash->{name} = 'Homer'; $c->stash->{template} = 'foo/bar'; # .mc is automatically added } # in root/comps/foo/bar.mc <%args> $.name </%args> Hello <% $.name %>! Your URI was <% $c->req->uri %>.
Allows you to use Mason 2.x for your views.
Class to use for creating the Mason object. Defaults to 'Mason'.
Other than any special mentioned keys above, the configuration for this view will be passed directly into Mason->new.
Mason->new
There are a few defaults specific to this view:
If not provided, defaults $c->path_to('root', 'comps').
$c->path_to('root', 'comps')
If not provided, defaults $c->path_to('data').
$c->path_to('data')
Automatically includes $c.
$c
All other defaults are standard Mason.
All components have access to $c, the current Catalyst context.
Renders the component specified in $c->stash->{template} or, if not specified, $c->action.
$c->stash->{template}
$c->action
The component path is prefixed with a '/' if it does not already have one, and Mason will automatically add a ".mc" extension - to change the latter, you can use
__PACKAGE__->config( autoextend_request_path => 0 );
Request arguments are taken from $c->stash.
$c->stash
Renders the component $path with \%args, and returns the output.
$path
\%args
Jonathan Swartz <swartz@pobox.com>
This software is copyright (c) 2011 by Jonathan Swartz.
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::Mason2, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Catalyst::View::Mason2
CPAN shell
perl -MCPAN -e shell install Catalyst::View::Mason2
For more information on module installation, please visit the detailed CPAN module installation guide.