The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

MooseX::Templated::View - Interface for MooseX::Templated views

SYNOPSIS

package MooseX::Templated::View::MyRenderer;

use Moose;
use My::Renderer;

with 'MooseX::Templated::View';

my %CONFIG = ( FOO => 1 );

sub build_default_template_suffix { '.tpl' }
sub build_renderer { My::Renderer->new( option => 1 ) }

# return rendered output as string
sub process {
    my $self = shift;

    # instantiated from view_class and view_config
    my $view = $self->view;

    # source will be provided by defaults
    my $source = $self->source;

    # get rendered output from backend
    my $output = $engine->some_render_method(
                    src   => $source,
                    stash => { self => $self },
                );

    return $output;
}

INTERFACE

process( $source, $model_object )

The individual view needs to implement this method to actually process the template.

DESCRIPTION

This role provides a general interface for backend template systems (e.g. MooseX::Templated::View::TT)

INCOMPATIBILITIES

None reported.

BUGS AND LIMITATIONS

No bugs have been reported.

Please report any bugs or feature requests to bug-moosex-templated@rt.cpan.org, or through the web interface at http://rt.cpan.org.

ACKNOWLEDGEMENTS

Chris Prather (perigrin)

AUTHOR

Ian Sillitoe <isillitoe@cpan.org>

LICENCE AND COPYRIGHT

Copyright (c) 2008, Ian Sillitoe <isillitoe@cpan.org>. All rights reserved.

This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See perlartistic.