1Dancer2::Core::Hook(3)User Contributed Perl DocumentationDancer2::Core::Hook(3)
2
3
4

NAME

6       Dancer2::Core::Hook - Manipulate hooks with Dancer2
7

VERSION

9       version 0.300005
10

SYNOPSIS

12         # inside a plugin
13         use Dancer2::Core::Hook;
14         Dancer2::Core::Hook->register_hooks_name(qw/before_auth after_auth/);
15

METHODS

17   register_hook ($hook_name, [$properties], $code)
18           hook 'before', {apps => ['main']}, sub {...};
19
20           hook 'before' => sub {...};
21
22       Attaches a hook at some point, with a possible list of properties.
23
24       Currently supported properties:
25
26       apps
27               an array reference containing apps name
28
29   register_hooks_name
30       Add a new hook name, so application developers can insert some code at
31       this point.
32
33           package My::Dancer2::Plugin;
34           Dancer2::Core::Hook->instance->register_hooks_name(qw/before_auth after_auth/);
35
36   execute_hook
37       Execute a hooks
38
39   get_hooks_for
40       Returns the list of coderef registered for a given position
41
42   hook_is_registered
43       Test if a hook with this name has already been registered.
44

AUTHOR

46       Dancer Core Developers
47
49       This software is copyright (c) 2021 by Alexis Sukrieh.
50
51       This is free software; you can redistribute it and/or modify it under
52       the same terms as the Perl 5 programming language system itself.
53
54
55
56perl v5.32.1                      2021-01-31            Dancer2::Core::Hook(3)
Impressum