1Dancer::Hook(3) User Contributed Perl Documentation Dancer::Hook(3)
2
3
4
6 Dancer::Hook - Class to manipulate hooks with Dancer
7
9 version 1.3513
10
12 # inside a plugin
13 use Dancer::Hook;
14 Dancer::Hook->register_hooks_name(qw/before_auth after_auth/);
15
17 Manipulate hooks with Dancer
18
20 register_hook ($hook_name, [$properties], $code)
21 hook 'before', {apps => ['main']}, sub {...};
22
23 hook 'before' => sub {...};
24
25 Attaches a hook at some point, with a possible list of properties.
26
27 Currently supported properties:
28
29 apps
30 an array reference containing apps name
31
32 register_hooks_name
33 Add a new hook name, so application developers can insert some code at
34 this point.
35
36 package My::Dancer::Plugin;
37 Dancer::Hook->instance->register_hooks_name(qw/before_auth after_auth/);
38
39 hook_is_registered
40 Test if a hook with this name has already been registered.
41
42 execute_hooks
43 Execute a list of hooks for some position
44
45 get_hooks_for
46 Returns the list of coderef registered for a given position
47
49 This module has been written by Alexis Sukrieh and others.
50
52 This module is free software and is published under the same terms as
53 Perl itself.
54
56 Dancer Core Developers
57
59 This software is copyright (c) 2010 by Alexis Sukrieh.
60
61 This is free software; you can redistribute it and/or modify it under
62 the same terms as the Perl 5 programming language system itself.
63
64
65
66perl v5.32.1 2021-01-27 Dancer::Hook(3)