NAME

Mojolicious::Plugin::Mason1Renderer - Mason 1 (aka HTML::Mason 1.x) Renderer Plugin.

VERSION

Version 0.03

SYNOPSIS

## 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>

DESCRIPTION

Mojolicous::Plugin::Mason1Renderer is a renderer for Mason 1 (aka HTML::Mason 1.x) template system.

Mojolicious::Controller object aka. $c

Mason templates have access to the Mojolicious::Controller object as global $c.

HTML::Mason comp_root

comp_root is set to default "MOJO_HOME/mason"

METHODS

Mojolicious::Plugin::Mason1Renderer inherits all methods from Mojolicious::Plugin and implements the following new ones.

register

$plugin->register;

Register renderer in Mojolicious application.

SEE ALSO

Mason 1, HTML::Mason, http://www.masonhq.com.

Mason 2, Mason.

Mason 2 Mojolicious Plugin, Mojolicious::Plugin::Mason2Renderer

AUTHOR

Alexandre SIMON, <asimon at cpan.org>

BUGS and SUPPORT

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:

ACKNOWLEDGEMENTS

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).

LICENSE AND COPYRIGHT

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.