Jonathan Rockway > Catalyst-View-MicroMason-0.05 > Catalyst::View::MicroMason

Download:
Catalyst-View-MicroMason-0.05.tar.gz

Dependencies

Annotate this POD

View/Report Bugs
Module Version: 0.05   Source  

NAME ^

Catalyst::View::MicroMason - MicroMason View Class

SYNOPSIS ^

Use the helper:

    script/create.pl view MicroMason MicroMason

To create a simple View subclass:

    # lib/MyApp/View/MicroMason.pm
    package MyApp::View::MicroMason;
    use base 'Catalyst::View::MicroMason';
    1;

And configure it in your app's config:

    MyApp->config->{View::MicroMason} = {
        # -Filters      : to use |h and |u
        # -ExecuteCache : to cache template output
        # -CompileCache : to cache the templates
        Mixins        => [qw( -Filters -CompileCache )], 
        INCLUDE_PATH  => '/path/to/comp_root'
    };

In an 'end' action:

    $c->view('MicroMason')->template('foo.mc');
    $c->forward('MyApp::View::MicroMason');

Or perhaps:

    my $output = $c->view('MicroMason')->render('foo.mc');

DESCRIPTION ^

Want to use a MicroMason component in your views? No problem! Catalyst::View::MicroMason comes to the rescue.

METHODS ^

new

Create an instance; should be called from COMPONENT, not by you.

process

Renders the component specified in $c->stash->{template} or by the value $c->action (if $c->stash->{template} is undefined). See Catalyst::View::Templated for all the details.

MicroMason global variables $base, $c (or whatever you pass in at config time as CATALYST_VAR) and c<$name> are automatically set to the base, context and name of the app, respectively.

An exception is thrown if processing fails, otherwise the output is stored in $c->response->body.

render([$template])

Renders the given template and returns output.

Throws an exception on error. If $template is not defined, it is determined by calling $self->template. See Catalyst::View::Templated for details.

SEE ALSO ^

Catalyst, Catalyst::View::Templated, Text::MicroMason, Catalyst::View::Mason

AUTHOR ^

Jonas Alves <jgda@cpan.org>

MAINTAINER ^

The Catalyst Core Team http://www.catalystframework.org

Jonathan Rockway <jrockway@cpan.org>

COPYRIGHT ^

This program is free software, you can redistribute it and/or modify it under the same terms as Perl itself.

syntax highlighting: