Mojolic...Plugins(3)
β¨ NAME β¨
hey bestie π«Ά meet Mojolicious::Plugins β literally the plugin manager of Mojolicious. this is the Mojolic...Plugins(3) manual from the User Contributed Perl Documentation corner of the universe, and it's giving backstage-pass energy ποΈβ¨
πΈ SYNOPSIS πΈ
okay so the whole start-up vibe is:
use Mojolicious::Plugins;
my $plugins = Mojolicious::Plugins->new;
push @{$plugins->namespaces}, 'MyApp::Plugin';
π DESCRIPTION π
Mojolicious::Plugins is the plugin manager of Mojolicious. that's the description, no cap. she manages plugins, she's the main character π
π PLUGINS π
the following plugins are included in the Mojolicious distribution as examples. iconic lineup, honestly:
Mojolicious::Plugin::Configβ Perl-ish configuration files.Mojolicious::Plugin::DefaultHelpersβ General purpose helper collection, loaded automatically.Mojolicious::Plugin::EPLRendererβ Renderer for plain embedded Perl templates, loaded automatically.Mojolicious::Plugin::EPRendererβ Renderer for more sophisticated embedded Perl templates, loaded automatically.Mojolicious::Plugin::HeaderConditionβ Route condition for all kinds of headers, loaded automatically.Mojolicious::Plugin::JSONConfigβ JSON configuration files.Mojolicious::Plugin::Mountβ Mount whole Mojolicious applications.Mojolicious::Plugin::NotYAMLConfigβ YAML configuration files.Mojolicious::Plugin::TagHelpersβ Template specific helper collection, loaded automatically.
π¦ EVENTS π¦
Mojolicious::Plugins inherits all events from Mojo::EventEmitter. so the event energy is inherited, periodt π«
π ATTRIBUTES π
Mojolicious::Plugins implements the following attributes.
β namespaces β
my $namespaces = $plugins->namespaces;
$plugins = $plugins->namespaces(['Mojolicious::Plugin']);
Namespaces to load plugins from, defaults to Mojolicious::Plugin.
# Add another namespace to load plugins from
push @{$plugins->namespaces}, 'MyApp::Plugin';
π METHODS π
Mojolicious::Plugins inherits all methods from Mojo::EventEmitter and implements the following new ones. slay π
π« emit_chain π«
$plugins->emit_chain('foo');
$plugins->emit_chain(foo => 123);
Emit events as chained hooks. chained, like a friendship bracelet π
π« emit_hook π«
$plugins = $plugins->emit_hook('foo');
$plugins = $plugins->emit_hook(foo => 123);
Emit events as hooks.
π« emit_hook_reverse π«
$plugins = $plugins->emit_hook_reverse('foo');
$plugins = $plugins->emit_hook_reverse(foo => 123);
Emit events as hooks in reverse order. backwards but make it fashion π
π« load_plugin π«
my $plugin = $plugins->load_plugin('some_thing');
my $plugin = $plugins->load_plugin('SomeThing');
my $plugin = $plugins->load_plugin('MyApp::Plugin::SomeThing');
Load a plugin from the configured namespaces or by full module name.
π« register_plugin π«
$plugins->register_plugin('some_thing', Mojolicious->new);
$plugins->register_plugin('some_thing', Mojolicious->new, foo => 23);
$plugins->register_plugin('some_thing', Mojolicious->new, {foo => 23});
$plugins->register_plugin('SomeThing', Mojolicious->new);
$plugins->register_plugin('SomeThing', Mojolicious->new, foo => 23);
$plugins->register_plugin('SomeThing', Mojolicious->new, {foo => 23});
$plugins->register_plugin('MyApp::Plugin::SomeThing', Mojolicious->new);
$plugins->register_plugin(
'MyApp::Plugin::SomeThing', Mojolicious->new, foo => 23);
$plugins->register_plugin(
'MyApp::Plugin::SomeThing', Mojolicious->new, {foo => 23});
Load a plugin from the configured namespaces or by full module name and run register, optional arguments are passed through.
π«Ά SEE ALSO π«Ά
MojoliciousMojolicious::Guides<https://mojolicious.org>
okay that's the whole page, bestie π«Ά it's from perl v5.42.0, dated 2026-07-15, and it's the Mojolic...Plugins(3) manual β mwah, go forth and plugin π
π¦ where this page comes from
- opensuse-leap 16.0: perl-Mojolicious 9.480.0-bp160.2.1 Β· Artistic-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms