Catmandu::Pluggable(3pm) | User Contributed Perl Documentation | Catmandu::Pluggable(3pm) |
Catmandu::Pluggable - A role for classes that need plugin capabilities
package My::Foo::Bar; use Role::Tiny; before foo => sub { print "Before foo!\n"; }; after foo => sub { print "After foo!\n"; }; sub extra { print "I can do extra too\n"; } package My::Foo; use Moo; with 'Catmandu::Pluggable'; sub plugin_namespace { 'My::Foo'; } sub foo { print "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;
Returns the namespace where all plugins for your class can be found.
This class method returns a subclass of your class with all provided plugins NAME-s implemented.
Catmandu::Bag, Catmandu::Plugin::Datestamps, Catmandu::Plugin::Versioning
2023-03-03 | perl v5.36.0 |