The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

IM::Engine::PluggableConstructor - provide new_with_plugins

DESCRIPTION

Some plugins need to extend built-in classes. For example, IM::Engine::Plugin::State needs to extend IM::Engine::User with methods such as get_state and set_state. This role provides a new constructor new_with_plugins to classes that need to be extensible. Plugins can then specify roles to use for the instance, as well as additional constructor parameters.

PARAMETERS

role_specifier

A string representing the role that can extend the consuming class. The role specifier uses the same rules as MooseX::Traits: prefix a + character to specify an absolute role name, otherwise the class's _trait_namespace is prepended.

METHODS

new_with_plugins

An alternate constructor that includes additional parameters specified by plugins. This also extends the traits option to include additional traits specified by plugins.

You must pass the engine argument so we can ask plugins about what to include.