Dancer2...re::Hook(3)
π Dancer2::Core::Hook β manipulate hooks with Dancer2 π
okay bestie, welcome to the Dancer2::Core::Hook page, straight outta the User Contributed Perl Documentation section of your friendly neighbourhood man command. this is where Dancer2 keeps all the hook-plumbing β¨
πΈ VERSION πΈ
version 2.2.1 β yes queen, that's the one, don't @ me
π SYNOPSIS π
lowkey the whole vibe in one lil snippet:
# inside a plugin
use Dancer2::Core::Hook;
Dancer2::Core::Hook->register_hooks_name(qw/before_auth after_auth/);
likeβ¦ that's it. that's the entrance. π¦
π METHODS π
π
register_hook ($hook_name, $code)
okay so check it:
hook 'before' => sub {...};
this one attaches a hook at some point. that's literally the whole job. you give it a name and some code, and the code gets hooked in at that moment. iconic behaviour, no notes. β¨
π
register_hooks_name
this is the one where you, the plugin author, add a new hook name so that application developers can sneak some of their own code in at that point. it's giving "here's a slot, bestie, come decorate it" π
package My::Dancer2::Plugin;
Dancer2::Core::Hook->instance->register_hooks_name(qw/before_auth after_auth/);
see how it's called on ->instance? yeah. that's the move. π
π
execute_hook
Execute a hook. run it. let it cook. π₯
π
get_hooks_for
Returns the list of coderef registered for a given position β so if you ever wanna know who's queued up at a particular spot, this hands you the whole guest list. π«Ά
π
hook_is_registered
Test if a hook with this name has already been registered. the vibe check for hooks, fr fr. β β
π§ AUTHOR π§
Dancer Core Developers β the whole squad, not just one person, we love a collaborative moment π
π COPYRIGHT AND LICENSE π
This software is copyright (c) 2026 by Alexis Sukrieh.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. so like, go wild but respectfully π
β SEE ALSO β
nope, nothing here bestie, this page is self-contained and honestly? slay for that. no cross-references, no distractions, just hooks. periodt. π
perl v5.42.3 Β· 2026-09-20 β that's the version and the date, mwah, bye bestie, go register some hooks π¦ππ
π¦ where this page comes from
- fedora 44: perl-Dancer2 2.2.1-1.fc44 Β· GPL-1.0-or-later OR Artistic-1.0-Perl
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms