Mojolicious::Plugin::Mason1Renderer - Mason 1 (aka HTML::Mason 1.x) Renderer Plugin.
Version 0.03
## Mojolicious::Lite # example -1- use Mojolicious::Lite; plugin 'mason1_renderer'; get '/' => sub { my $self = shift; $self->render('/index', handler => "mason" ); }; app->start; # template: MOJO_HOME/mason/index <html> <body>Welcome</body> </html> # example -2- use Mojolicious::Lite; plugin 'mason1_renderer' => { interp_params => { comp_root => "/path/to/mason/comps", ... (other parameters to the new() HTML::Mason::Interp constructor) }, request_params => { error_format => "brief", ... (other parameters to the new() HTML::Mason::Request constructor) }, }; get '/' => sub { my $self = shift; $self->render('/index', handler => "mason", mytext => "Hello world" ); }; app->start; # template: /path/to/mason/comps/index <%args> $mytext => undef </%args> <html> <body>Welcome : <% $mytext %></body> </html> ## Mojolicious # example -1- package MyApp; use Mojo::Base 'Mojolicious'; sub startup { my $self = shift; $self->plugin('mason1_renderer'); $self->routes->get('/' => sub { my $self = shift; $self->render('/index', handler => "mason" ); } ); } 1; # template: MOJO_HOME/mason/index <html> <body>Welcome</body> </html> # example -2- package MyApp; use Mojo::Base 'Mojolicious'; sub startup { my $self = shift; $self->plugin('mason1_renderer', { interp_params => { comp_root => "/path/to/mason/comps", ... (other parameters to the new() HTML::Mason::Interp constructor) }, request_params => { error_format => "brief", ... (other parameters to the new() HTML::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 <%args> $mytext => undef </%args> <html> <body> Welcome : <% $mytext %><br/> Mason root_comp is <% $c->app->home %><br/> </body> </html>
Mojolicous::Plugin::Mason1Renderer is a renderer for Mason 1 (aka HTML::Mason 1.x) template system.
Mason templates have access to the Mojolicious::Controller object as global $c.
comp_root is set to default "MOJO_HOME/mason"
comp_root
Mojolicious::Plugin::Mason1Renderer inherits all methods from Mojolicious::Plugin and implements the following new ones.
$plugin->register;
Register renderer in Mojolicious application.
Mason 1, HTML::Mason, http://www.masonhq.com.
Mason 2, Mason.
Mason 2 Mojolicious Plugin, Mojolicious::Plugin::Mason2Renderer
Alexandre SIMON, <asimon at cpan.org>
<asimon at cpan.org>
You can find documentation for this module with the perldoc command.
perldoc Mojolicious::Plugin::Mason1Renderer
Bugs and feature requests will be tracked at RT:
http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Mojolicious-Plugin-Mason1Renderer bug-mojolicious-plugin-mason1renderer at rt.cpan.org
The latest source code can be browsed and fetched at:
https://github.com/igit/Mojolicious-Plugin-Mason1Renderer git clone git://github.com/igit/Mojolicious-Plugin-Mason1Renderer.git
You can also look for information at:
RT: CPAN's request tracker
http://rt.cpan.org/NoAuth/Bugs.html?Dist=Mojolicious-Plugin-Mason1Renderer
AnnoCPAN: Annotated CPAN documentation
http://annocpan.org/dist/Mojolicious-Plugin-Mason1Renderer
CPAN Ratings
http://cpanratings.perl.org/d/Mojolicious-Plugin-Mason1Renderer
Search CPAN
http://search.cpan.org/dist/Mojolicious-Plugin-Mason1Renderer/
Original idea was taken from Graham BARR (http://search.cpan.org/~gbarr/) MojoX::Renderer::Mason module. This module was not longer adapted to Mojolicious new Plugin philosophy.
Many, many thanks to Sebastian RIEDEL for developping Mojolicious and Jonathan SWARTZ for developping HTML::Mason and Mason (2).
Copyright 2011 Alexandre SIMON.
This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.
See http://dev.perl.org/licenses/ for more information.
To install Mojolicious::Plugin::Mason1Renderer, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Mojolicious::Plugin::Mason1Renderer
CPAN shell
perl -MCPAN -e shell install Mojolicious::Plugin::Mason1Renderer
For more information on module installation, please visit the detailed CPAN module installation guide.