NAME
Catmandu::Pluggable - A role for classes that need plugin capabilities
SYNOPSIS
package
My::Foo::Bar;
use
Role::Tiny;
before
foo
=>
sub
{
"Before foo!\n"
;
};
after
foo
=>
sub
{
"After foo!\n"
;
};
sub
extra {
"I can do extra too\n"
;
}
package
My::Foo;
use
Moo;
sub
plugin_namespace {
'My::Foo'
;
}
sub
foo {
"Foo!\n"
;
}
package
main;
my
$x
= My::Foo->with_plugins(
'Bar'
)->new;
# prints:
# Before foo!
# Foo!
# After foo!
$x
->foo;
# prints:
# I can do extra too
$x
->extra;
METHODS
plugin_namespace
Returns the namespace where all plugins for your class can be found.
with_plugins(NAME)
with_plugins(NAME,NAME,...)
This class method returns a subclass of your class with all provided plugins NAME-s implemented.
SEE ALSO
Catmandu::Bag, Catmandu::Plugin::Datestamps, Catmandu::Plugin::Versioning