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::TagHelpers
44         Template specific helper collection, loaded automatically.
45

EVENTS

47       Mojolicious::Plugins inherits all events from Mojo::EventEmitter.
48

ATTRIBUTES

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

METHODS

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

SEE ALSO

107       Mojolicious, Mojolicious::Guides, <https://mojolicious.org>.
108
109
110
111perl v5.28.0                      2018-11-01           Mojolicious::Plugins(3)
Impressum