NAME
Catalyst::View::Template::Lace::Renderer - Adapt Template::Lace for Catalyst
SYNOPSIS
TBD
DESCRIPTION
Subclass of Template::Lace:Renderer with some useful, Catalyst specific methods.
METHODS
This class defines the following public methods
respond
$view->respond($status);
$view->respond($status, @headers);
$view->respond(@headers);
Used to setup a response. Calling this method will setup an http status, finalize headers and set a body response for the HTML. Content type will be set to 'text/html' automatically. Status is 200 unless you specify otherwise.
overlay_view
Helper method to allow you to wrap or overlay the current view with another view (like a master page view or some other transformation that you prefer to have under the control of the controller). Example:
$c->view('User',
name => 'John',
age => 42,
motto => 'Why Not?')
->overlay_view(
'Master', sub {
my $user_dom = shift; # also $_ is localised to this for ease of use
title => $_->at('title')->content,
css => $_->find('link'),
meta => $_->find('meta'),
body => $_->at('body')->content}, @more_args_for_MasterView)
->http_ok;
Although you can do this via the template with components there might be cases where you want this under the controller. For example you might use different wrappers based on the logged in user (although again smart use of components could solve that as well; the choice is yours).
detach
Proxy to '$c->detach'
view
Proxy to '$c->detach'
ctx
Proxy to '$c->ctx'
Reponse Helpers
We map status codes from HTTP::Status into methods to make sending common request types more simple and more descriptive. The following are the same:
$c->view->respond(200, @args);
$c->view->http_ok(@args);
do { $c->view->respond(200, @args); $c->detach };
$c->view->http_ok(@args)->detach;
See HTTP::Status for a full list of all the status code helpers.
AUTHOR
John Napiorkowski email:jjnapiork@cpan.org
SEE ALSO
Template::Lace, Catalyst::View::Template::Lace
COPYRIGHT & LICENSE
Copyright 2017, John Napiorkowski email:jjnapiork@cpan.org
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.