1Dancer2::Core::Hook(3)User Contributed Perl DocumentationDancer2::Core::Hook(3)
2
3
4
6 Dancer2::Core::Hook - Manipulate hooks with Dancer2
7
9 version 0.400000
10
12 # inside a plugin
13 use Dancer2::Core::Hook;
14 Dancer2::Core::Hook->register_hooks_name(qw/before_auth after_auth/);
15
17 register_hook ($hook_name, $code)
18 hook 'before' => sub {...};
19
20 Attaches a hook at some point.
21
22 register_hooks_name
23 Add a new hook name, so application developers can insert some code at
24 this point.
25
26 package My::Dancer2::Plugin;
27 Dancer2::Core::Hook->instance->register_hooks_name(qw/before_auth after_auth/);
28
29 execute_hook
30 Execute a hook
31
32 get_hooks_for
33 Returns the list of coderef registered for a given position
34
35 hook_is_registered
36 Test if a hook with this name has already been registered.
37
39 Dancer Core Developers
40
42 This software is copyright (c) 2022 by Alexis Sukrieh.
43
44 This is free software; you can redistribute it and/or modify it under
45 the same terms as the Perl 5 programming language system itself.
46
47
48
49perl v5.36.0 2023-01-20 Dancer2::Core::Hook(3)