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 🫢

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