Dancer2::Template::Mason2 - Mason 2.x engine for Dancer2
version 0.01
In config.yml
config.yml
template: "mason2"
In MyApp.pm
MyApp.pm
get '/foo' => sub { template foo => { title => 'bar', }; };
In views/foo.mc
views/foo.mc
<%args> $.title </%args> <h1><% $.title %></h1> <p>Hello World!</p>
Dancer2::Template::Mason2 is a template engine that allows you to use Mason 2.x with Dancer2.
In order to use this engine, set the template to 'mason2' in the Dancer2 configuration file:
The default template extension is '.mc'.
Paramters can also be passed to Mason->new() via the configuration file like so:
Mason->new()
engines: mason2: data_dir: /path/to/data_dir
comp_root defaults to the views configuration setting or, if it is undefined, to the /views subdirectory of the application.
comp_root
views
/views
data_dir defaults to /data subdirectory in the project root directory.
data_dir
/data
Dancer2, Mason
David Betz <hashref@gmail.com>
Copyright (C) David Betz.
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install Dancer2::Template::Mason2, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Dancer2::Template::Mason2
CPAN shell
perl -MCPAN -e shell install Dancer2::Template::Mason2
For more information on module installation, please visit the detailed CPAN module installation guide.