NAME
MojoX::Renderer - Renderer
SYNOPSIS
use MojoX::Renderer;
my $renderer = MojoX::Renderer->new;
DESCRIPTION
MojoX::Renderer is a MIME type based renderer.
ATTRIBUTES
MojoX::Types implements the follwing attributes.
default_format
my $default = $renderer->default_format;
$renderer = $renderer->default_format('html');
default_handler
my $default = $renderer->default_handler;
$renderer = $renderer->default_handler('epl');
default_status
my $default = $renderer->default_status;
$renderer = $renderer->default_status(404);
encoding
my $encoding = $renderer->encoding;
$renderer = $renderer->encoding('koi8-r');
handler
my $handler = $renderer->handler;
$renderer = $renderer->handler({epl => sub { ... }});
layout_prefix
my $prefix = $renderer->layout_prefix;
$renderer = $renderer->layout_prefix('layouts');
root
my $root = $renderer->root;
$renderer = $renderer->root('/foo/bar/templates');
types
my $types = $renderer->types;
$renderer = $renderer->types(MojoX::Types->new);
METHODS
MojoX::Types inherits all methods from Mojo::Base and implements the follwing the ones.
new
my $renderer = MojoX::Renderer->new;
add_handler
$renderer = $renderer->add_handler(epl => sub { ... });
render
my $success = $renderer->render($c);
$c->stash->{partial} = 1;
my $output = $renderer->render($c);
template_name
my $template = $renderer->template_path({
template => 'foo/bar',
format => 'html',
handler => 'epl'
});
template_path
my $path = $renderer->template_name({
template => 'foo/bar',
format => 'html',
handler => 'epl'
});