Catalyst-View-Xslate
view release on metacpan or search on metacpan
lib/Catalyst/View/Xslate.pm view on Meta::CPAN
$vars->{$exposed_method} = $self->build_exposed_method($c, $code);
} else {
Catalyst::Exception->throw( "$exposed_method not found in Xslate view" );
}
}
}
local $vars->{ $self->catalyst_var } =
$vars->{ $self->catalyst_var } || $c;
if(ref $template eq 'SCALAR') {
return $self->xslate->render_string( $$template, $vars );
} else {
return $self->xslate->render($template, $vars );
}
}
sub _rendering_error {
my ($self, $c, $err) = @_;
my $error = qq/Couldn't render template "$err"/;
$c->log->error($error);
$c->error($error);
return 0;
}
__PACKAGE__->meta->make_immutable();
1;
__END__
=head1 NAME
Catalyst::View::Xslate - Text::Xslate View Class
=head1 SYNOPSIS
package MyApp::View::Xslate;
use Moose;
extends 'Catalyst::View::Xslate';
1;
=head1 VIEW CONFIGURATION
You may specify the following configuration items in from your config file
or directly on the view object.
=head2 catalyst_var
The name used to refer to the Catalyst app object in the template
=head2 template_extension
The suffix used to auto generate the template name from the action name
(when you do not explicitly specify the template filename);
Do not confuse this with the C<suffix> option, which is passed directly to
the Text::Xslate object instance. This option works on the filename used
for the initial request, while C<suffix> controls what C<cascade> and
C<include> directives do inside Text::Xslate.
=head2 content_charset
The charset used to output the response body. The value defaults to 'UTF-8'.
=head2 encode_body
By default, output will be encoded to C<content_charset>.
You can set it to 0 to disable this behavior.
(you need to do this if you're using C<Catalyst::Plugin::Unicode::Encoding>)
B<NOTE> Starting with L<Catalyst> version 5.90080 Catalyst will automatically
encode to UTF8 any text like body responses. You should either turn off the
body encoding step in this view using this attribute OR disable this feature
in the application (your subclass of Catalyst.pm).
MyApp->config(encoding => undef);
Failure to do so will result in double encoding.
=head2 Text::Xslate CONFIGURATION
The following parameters are passed to the Text::Xslate constructor.
When reset during the life cyle of the Catalyst app, these parameters will
cause the previously created underlying Text::Xslate object to be cleared
=head2 path
=head2 cache_dir
=head2 cache
=head2 header
=head2 escape
=head2 type
=head2 footer
=head2 function
=head2 input_layer
=head2 module
=head2 syntax
=head2 verbose
=head2 line_start
=head2 tag_start
=head2 tag_end
=head2 warn_handler
=head2 die_handler
( run in 1.988 second using v1.01-cache-2.11-cpan-d06a3f9ecfd )