| 1 |
NAME |
| 2 |
Catalyst::Action::RenderView - Sensible default end action. |
| 3 |
|
| 4 |
SYNOPSIS |
| 5 |
sub end : ActionClass('RenderView') {} |
| 6 |
|
| 7 |
DESCRIPTION |
| 8 |
This action implements a sensible default end action, which will forward |
| 9 |
to the first available view, unless "$c->res->status" is a 3xx code |
| 10 |
(redirection, not modified, etc.), 204 (no content), or "$c->res->body" |
| 11 |
has already been set. It also allows you to pass "dump_info=1" to the |
| 12 |
url in order to force a debug screen, while in debug mode. |
| 13 |
|
| 14 |
If you have more than one view, you can specify which one to use with |
| 15 |
the "default_view" config setting and the "current_view" and |
| 16 |
"current_view_instance" stash keys (see Catalyst's "$c->view($name)" |
| 17 |
method -- this module simply calls "$c->view" with no argument). |
| 18 |
|
| 19 |
METHODS |
| 20 |
end |
| 21 |
The default "end" action. You can override this as required in your |
| 22 |
application class; normal inheritance applies. |
| 23 |
|
| 24 |
INTERNAL METHODS |
| 25 |
execute |
| 26 |
Dispatches control to superclasses, then forwards to the default View. |
| 27 |
|
| 28 |
See "METHODS/action" in Catalyst::Action. |
| 29 |
|
| 30 |
SCRUBBING OUTPUT |
| 31 |
When you force debug with dump_info=1, RenderView is capable of removing |
| 32 |
classes from the objects in your stash. By default it will replace any |
| 33 |
DBIx::Class ResultSource objects with the class name, which cleans up |
| 34 |
the debug output considerably, but you can change what gets scrubbed by |
| 35 |
setting a list of classes in |
| 36 |
$c->config->{'Action::RenderView'}->{ignore_classes}. For instance: |
| 37 |
|
| 38 |
$c->config->{'Action::RenderView'}->{ignore_classes} = []; |
| 39 |
|
| 40 |
To disable the functionality. You can also set |
| 41 |
config->{'Action::RenderView'}->{scrubber_func} to change what it does |
| 42 |
with the classes. For instance, this will undef it instead of putting in |
| 43 |
the class name: |
| 44 |
|
| 45 |
$c->config->{'Action::RenderView'}->{scrubber_func} = sub { undef $_ }; |
| 46 |
|
| 47 |
Deprecation notice |
| 48 |
This plugin used to be configured by setting "$c->config->{debug}". That |
| 49 |
configuration key is still supported in this release, but is deprecated, |
| 50 |
please use the 'Action::RenderView' namespace as shown above for |
| 51 |
configuration in new code. |
| 52 |
|
| 53 |
EXTENDING |
| 54 |
To add something to an "end" action that is called before rendering, |
| 55 |
simply place it in the "end" method: |
| 56 |
|
| 57 |
sub end : ActionClass('RenderView') { |
| 58 |
my ( $self, $c ) = @_; |
| 59 |
# do stuff here; the RenderView action is called afterwards |
| 60 |
} |
| 61 |
|
| 62 |
To add things to an "end" action that are called *after* rendering, you |
| 63 |
can set it up like this: |
| 64 |
|
| 65 |
sub render : ActionClass('RenderView') { } |
| 66 |
|
| 67 |
sub end : Private { |
| 68 |
my ( $self, $c ) = @_; |
| 69 |
$c->forward('render'); |
| 70 |
# do stuff here |
| 71 |
} |
| 72 |
|
| 73 |
AUTHORS |
| 74 |
* Marcus Ramberg <[email protected]> |
| 75 |
|
| 76 |
* Florian Ragwitz <[email protected]> |
| 77 |
|
| 78 |
CONTRIBUTOR |
| 79 |
Graham Knop <[email protected]> |
| 80 |
|
| 81 |
COPYRIGHT AND LICENSE |
| 82 |
This software is copyright (c) 2006 - 2009 by Marcus Ramberg and Florian |
| 83 |
Ragwitz. |
| 84 |
|
| 85 |
This is free software; you can redistribute it and/or modify it under |
| 86 |
the same terms as the Perl 5 programming language system itself. |
| 87 |
|