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';
12
13 sub register {
14 my ($self, $app, $conf) = @_;
15
16 # Magic here! :)
17 }
18
20 Mojolicious::Plugin is an abstract base class for Mojolicious plugins.
21
22 See "PLUGINS" in Mojolicious::Plugins for a list of plugins that are
23 available by default.
24
26 Mojolicious::Plugin inherits all methods from Mojo::Base and implements
27 the following new ones.
28
29 register
30 $plugin->register(Mojolicious->new);
31 $plugin->register(Mojolicious->new, {foo => 'bar'});
32
33 This method will be called by Mojolicious::Plugins at startup time.
34 Meant to be overloaded in a subclass.
35
37 Mojolicious, Mojolicious::Guides, <https://mojolicious.org>.
38
39
40
41perl v5.32.0 2020-07-28 Mojolicious::Plugin(3)