IM::Engine::PluggableConstructor - provide new_with_plugins


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.



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.



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.