***** DESCRIPTION Mojolicous::Plugin::Mason2Renderer is a renderer for Mason 2 (aka Mason 2.x) template system, plugabble into Mojolicious web framework. Mojolicious : http://www.mojolicious.org/ http://search.cpan.org/~kraih/Mojolicious/ Mason (2) : http://search.cpan.org/~jswartz/Mason/ ***** SYNOPSIS ## Mojolicious::Lite # example -1- use Mojolicious::Lite; plugin 'mason2_renderer'; get '/' => sub { my $self = shift; $self->render('/index', handler => "mason" ); }; app->start; # template: MOJO_HOME/mason/index.mc
Welcome # example -2- use Mojolicious::Lite; plugin 'mason2_renderer' => { preload_regexps => [ '.mc$', '/path/to/comps/to/preload', ... ], interp_params => { comp_root => "/path/to/mason/comps", ... (other parameters to the new() Mason::Interp constructor) }, request_params => { ... (other parameters to the new() Mason::Request constructor) }, }; get '/' => sub { my $self = shift; $self->render('/index', handler => "mason", mytext => "Hello world" ); }; app->start; # template: /path/to/mason/comps/index.mc <%class> has 'mytext'; %class> Welcome : <% $self->mytext %> ## Mojolicious # example -1- package MyApp; use Mojo::Base 'Mojolicious'; sub startup { my $self = shift; $self->plugin('mason2_renderer'); $self->routes->get('/' => sub { my $self = shift; $self->render('/index', handler => "mason" ); } ); } 1; # template: MOJO_HOME/mason/index.mc Welcome # example -2- package MyApp; use Mojo::Base 'Mojolicious'; sub startup { my $self = shift; $self->plugin('mason2_renderer', { preload_regexps => [ '.mc$', '/path/to/comps/to/preload', ... ], interp_params => { comp_root => "/path/to/mason/comps", ... (other parameters to the new() Mason::Interp constructor) }, request_params => { ... (other parameters to the new() Mason::Request constructor) }, } ); $self->routes->get('/' => sub { my $self = shift; $self->render('/index', handler => "mason", mytext => "Hello World" ); } ); } 1; # template: /path/to/mason/comps/index.mc <%class> has 'mytext'; %class> Welcome : <% $self->mytext %>