MooseX:...gPlugins(3)
π¦ MooseX::App::WritingPlugins β writing plugins for MooseX::App
okay bestie, so this is the MooseX::App::WritingPlugins page, straight out of the User Contributed Perl Documentation π
and it's literally your whole guide to making your own plugins. no cap, it's shorter than you'd think and honestly? iconic for that.
β¨ SYNOPSIS β¨
here's the vibe, in code, exactly as written:
package MooseX::App::Plugin::MyPlugin;
use Moose::Role;
sub plugin_metaroles {
my ($self,$class) = @_;
return {
class => ['MooseX::App::Plugin::MyPlugin::Meta::Class'],
}
}
around 'initialize_command_class' => sub {
...
};
that's the whole shape of it π«Ά a package, a Moose::Role, a callback, and a method modifier. slay.
π DESCRIPTION π
so here's the tea: plugins are implemented as Moose roles, and they must live in the MooseX::App::Plugin::* namespace. that's not a suggestion, that's the rule, periodt.
you can alter metaclasses through the 'plugin_metaroles' callback method. and on top of that, you get all the Moose method modifiers β around, after, before β to change up how MooseX::App behaves, or how its meta classes behave. literally the whole toolkit π
π« CALLBACKS π«
plugin_metaroles
this one's an optional callback method. should it exist, it should return a hash reference saying which metaroles get applied to the class metaclass, plus its contained metaclasses and helper classes π§
each key should in turn point to an array reference of role names.
it accepts the following keys:
classπattributeβ¨methodπwrapped_methodπ¦instanceπΈconstructorπdestructorπ«Άerrorπ
that's all eight, we're not skipping a single one, bestie π
π METACLASSES π
most of the MooseX-App behaviour is implemented in metaclass roles. so when you're writing plugins, you will most likely need to alter or augment the behaviour of these roles. the implementation details live in the respective packages β go peek, iykyk π₯
MooseX::App::Meta::Role::Class::Baseis applied to the base metaclassMooseX::App::Meta::Role::Class::Commandis applied to the command metaclassMooseX::App::Meta::Role::Attribute::Optionis applied to all attributes in the base and command meta classes
lowkey the move here is to read those three packages before you touch anything, fr fr β this page points you at them but the details are theirs, not mine π
and that's the page!! no notes, we ate. this little masterpiece is perl v5.42.0 dated 2024-08-09, so go forth and plugin-ify responsibly βπ
π¦ where this page comes from
- opensuse-leap 16.0: perl-MooseX-App 1.430.1-bp160.1.10 Β· Artistic-1.0 OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms