1Mojolicious::Plugin(3)User Contributed Perl DocumentationMojolicious::Plugin(3)
2
3
4
6 Mojolicious::Plugin - Plugin base class
7
9 # CamelCase plugin name
10 package Mojolicious::Plugin::MyPlugin;
11 use Mojo::Base 'Mojolicious::Plugin', -signatures;
12
13 sub register ($self, $app, $conf) {
14
15 # Magic here! :)
16 }
17
19 Mojolicious::Plugin is an abstract base class for Mojolicious plugins.
20
21 See "PLUGINS" in Mojolicious::Plugins for a list of plugins that are
22 available by default.
23
25 Mojolicious::Plugin inherits all methods from Mojo::Base and implements
26 the following new ones.
27
28 register
29 $plugin->register(Mojolicious->new);
30 $plugin->register(Mojolicious->new, {foo => 'bar'});
31
32 This method will be called by Mojolicious::Plugins at startup time.
33 Meant to be overloaded in a subclass.
34
36 Mojolicious, Mojolicious::Guides, <https://mojolicious.org>.
37
38
39
40perl v5.36.0 2023-01-20 Mojolicious::Plugin(3)