Cataly...erView(3pm)
π NAME π
Catalyst::Action::RenderView β the sensible default end action, bestie. It's giving "just works" energy. π
β¨ SYNOPSIS β¨
sub end : ActionClass('RenderView') {}
That's it. That's the whole vibe. One line and you're slaying. π
π¦ DESCRIPTION π¦
Okay so listen. This action implements a sensible default end action. What does it do? It forwards to the first available view. That's the main character move. π
BUT β and this is the important part, no cap β it will not do that if any of these are true:
$c->res->statusis a 3xx code (redirection, not modified, etc.)$c->res->statusis 204 (no content)$c->res->bodyhas already been set
It also lets you pass dump_info=1 to the url to force a debug screen, but only while you're in debug mode. πβ¨
And if you have more than one view (look at you, overachiever π), you can specify which one gets used with the default_view config setting and the current_view and current_view_instance stash keys. See Catalyst's $c->view($name) method β this module literally just calls $c->view with no argument. Simple. Iconic. Periodt.
πΈ METHODS πΈ
end
The default end action, bestie. You can override this in your application class whenever you need to β normal inheritance applies, so go off. π«Ά
π§ INTERNAL METHODS π§
execute
Dispatches control to superclasses, then forwards to the default View. That's the whole job description.
See "METHODS/action" in Catalyst::Action.
π SCRUBBING OUTPUT π
So when you force debug with dump_info=1, RenderView is capable of removing classes from the objects in your stash. Like a little cleanup fairy. π§Ήβ¨
By default it will replace any DBIx::Class ResultSource objects with the class name, which cleans up the debug output considerably. Huge glow-up for your terminal, fr fr.
But you can change what gets scrubbed by setting a list of classes in $c->config->{'Action::RenderView'}->{ignore_classes}. For instance:
$c->config->{'Action::RenderView'}->{ignore_classes} = [];
That's how you disable the functionality entirely. π
You can also set config->{'Action::RenderView'}->{scrubber_func} to change what it does with the classes. For instance, this will undef it instead of putting in the class name:
$c->config->{'Action::RenderView'}->{scrubber_func} = sub { undef $_ };
Deprecation notice β οΈ
Okay so this plugin used to be configured by setting $c->config->{debug}. That configuration key is still supported in this release, but it is deprecated β so please use the 'Action::RenderView' namespace as shown above for configuration in new code. Don't be out here using deprecated keys, babe, it's not the move. π
π EXTENDING π
Wanna add something to an end action that gets called before rendering? Simply place it in the end method:
sub end : ActionClass('RenderView') {
my ( $self, $c ) = @_;
# do stuff here; the RenderView action is called afterwards
}
Wanna add things to an end action that get called after rendering? Set it up like this:
sub render : ActionClass('RenderView') { }
sub end : Private {
my ( $self, $c ) = @_;
$c->forward('render');
# do stuff here
}
Two ways to do it, both valid, both slay. Choose your fighter. π₯
π AUTHORS π
- Marcus Ramberg <marcus@thefeed.no>
- Florian Ragwitz <rafl@debian.org>
π CONTRIBUTOR π
Graham Knop <haarg@haarg.org>
π COPYRIGHT AND LICENSE π
This software is copyright (c) 2006 - 2009 by Marcus Ramberg and Florian Ragwitz.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. π«Ά
Okay bestie, that's the whole page β this was Cataly...erView(3pm) from perl v5.40.0, dated 2024-10-28. Go forth and render those views, you absolute icon. π
β¨π¦
π¦ where this page comes from
- debian trixie: libcatalyst-action-renderview-perl 0.17-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libcatalyst-action-renderview-perl 0.17-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libcatalyst-action-renderview-perl 0.17-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms