Dancer::Hook(3pm)

πŸ’– Dancer::Hook πŸ’–

okay bestie, so this is Dancer::Hook β€” the class that lets you mess with hooks in Dancer. it's part of the User Contributed Perl Documentation crew, iykyk 🫢


✨ VERSION ✨

we're on version 1.3522, babes πŸ’…


πŸŽ€ SYNOPSIS πŸŽ€

so like, if you're inside a plugin and you want to do the thing:

# inside a plugin
use Dancer::Hook;
Dancer::Hook->register_hooks_name(qw/before_auth after_auth/);

that's it, that's the vibe ✨


🌸 DESCRIPTION 🌸

okay so the whole point of this module: you manipulate hooks with Dancer. that's literally the description, fr fr. hooks = the little spots where code can jump in and do stuff. this class is the plug that makes that happen. πŸ¦‹


πŸ‘‘ METHODS πŸ‘‘

πŸ’« register_hook ($hook_name, [$properties], $code)

attaches a hook at some point, and you can pass a list of properties if you're feeling extra:

hook 'before', {apps => ['main']}, sub {...};

hook 'before' => sub {...};

πŸ“ Currently supported properties

  • apps β€” an array reference containing apps name. that's the one and only property on the menu rn, bestie.

πŸ’« register_hooks_name

this one adds a new hook name, so that application developers can insert some code at this point. it's giving "make space for the girlies to write their own code here" πŸ’…

package My::Dancer::Plugin;
Dancer::Hook->instance->register_hooks_name(qw/before_auth after_auth/);

πŸ’« hook_is_registered

test if a hook with this name has already been registered. vibe check on your hook names, basically. βœ…

πŸ’« execute_hooks

execute a list of hooks for some position. go go go, run 'em πŸ”₯

πŸ’« get_hooks_for

returns the list of coderef registered for a given position. so like, "who's signed up for this spot?" and it tells you πŸ‘€


🧚 AUTHORS 🧚

this module has been written by Alexis Sukrieh and others. shoutout to the others, we see you 🫢


πŸŽ€ LICENSE πŸŽ€

this module is free software and is published under the same terms as Perl itself. free as in, go wild, bestie 🌈


⭐ AUTHOR ⭐

the Dancer Core Developers. icons only, no cap πŸ‘‘


this software is copyright (c) 2010 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.

ngl that's the exact same energy as the LICENSE section above, but here it is again because copyright said so 😭

alright bestie, that's the whole page πŸ’– this was perl v5.40.1, dated 2026-05-05, coming at you straight from the User Contributed Perl Documentation β€” mwah, slay, periodt πŸŽ€βœ¨πŸ’…

πŸ“¦ where this page comes from