1Mojolicious::Plugins(3)User Contributed Perl DocumentatioMnojolicious::Plugins(3)
2
3
4

NAME

6       Mojolicious::Plugins - Plugin manager
7

SYNOPSIS

9         use Mojolicious::Plugins;
10
11         my $plugins = Mojolicious::Plugins->new;
12         push @{$plugins->namespaces}, 'MyApp::Plugin';
13

DESCRIPTION

15       Mojolicious::Plugins is the plugin manager of Mojolicious.
16

PLUGINS

18       The following plugins are included in the Mojolicious distribution as
19       examples.
20
21       Mojolicious::Plugin::Config
22         Perl-ish configuration files.
23
24       Mojolicious::Plugin::DefaultHelpers
25         General purpose helper collection, loaded automatically.
26
27       Mojolicious::Plugin::EPLRenderer
28         Renderer for plain embedded Perl templates, loaded automatically.
29
30       Mojolicious::Plugin::EPRenderer
31         Renderer for more sophisticated embedded Perl templates, loaded
32         automatically.
33
34       Mojolicious::Plugin::HeaderCondition
35         Route condition for all kinds of headers, loaded automatically.
36
37       Mojolicious::Plugin::JSONConfig
38         JSON configuration files.
39
40       Mojolicious::Plugin::Mount
41         Mount whole Mojolicious applications.
42
43       Mojolicious::Plugin::NotYAMLConfig
44         YAML configuration files.
45
46       Mojolicious::Plugin::TagHelpers
47         Template specific helper collection, loaded automatically.
48

EVENTS

50       Mojolicious::Plugins inherits all events from Mojo::EventEmitter.
51

ATTRIBUTES

53       Mojolicious::Plugins implements the following attributes.
54
55   namespaces
56         my $namespaces = $plugins->namespaces;
57         $plugins       = $plugins->namespaces(['Mojolicious::Plugin']);
58
59       Namespaces to load plugins from, defaults to Mojolicious::Plugin.
60
61         # Add another namespace to load plugins from
62         push @{$plugins->namespaces}, 'MyApp::Plugin';
63

METHODS

65       Mojolicious::Plugins inherits all methods from Mojo::EventEmitter and
66       implements the following new ones.
67
68   emit_chain
69         $plugins->emit_chain('foo');
70         $plugins->emit_chain(foo => 123);
71
72       Emit events as chained hooks.
73
74   emit_hook
75         $plugins = $plugins->emit_hook('foo');
76         $plugins = $plugins->emit_hook(foo => 123);
77
78       Emit events as hooks.
79
80   emit_hook_reverse
81         $plugins = $plugins->emit_hook_reverse('foo');
82         $plugins = $plugins->emit_hook_reverse(foo => 123);
83
84       Emit events as hooks in reverse order.
85
86   load_plugin
87         my $plugin = $plugins->load_plugin('some_thing');
88         my $plugin = $plugins->load_plugin('SomeThing');
89         my $plugin = $plugins->load_plugin('MyApp::Plugin::SomeThing');
90
91       Load a plugin from the configured namespaces or by full module name.
92
93   register_plugin
94         $plugins->register_plugin('some_thing', Mojolicious->new);
95         $plugins->register_plugin('some_thing', Mojolicious->new, foo => 23);
96         $plugins->register_plugin('some_thing', Mojolicious->new, {foo => 23});
97         $plugins->register_plugin('SomeThing', Mojolicious->new);
98         $plugins->register_plugin('SomeThing', Mojolicious->new, foo => 23);
99         $plugins->register_plugin('SomeThing', Mojolicious->new, {foo => 23});
100         $plugins->register_plugin('MyApp::Plugin::SomeThing', Mojolicious->new);
101         $plugins->register_plugin(
102           'MyApp::Plugin::SomeThing', Mojolicious->new, foo => 23);
103         $plugins->register_plugin(
104           'MyApp::Plugin::SomeThing', Mojolicious->new, {foo => 23});
105
106       Load a plugin from the configured namespaces or by full module name and
107       run "register", optional arguments are passed through.
108

SEE ALSO

110       Mojolicious, Mojolicious::Guides, <https://mojolicious.org>.
111
112
113
114perl v5.36.0                      2022-07-22           Mojolicious::Plugins(3)
Impressum