Catmandu::Pluggable(3pm)

Catmandu::Pluggable3pm

A role for classes that need plugin capabilities

Usage

    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;

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.

Releases

6 releases since Debian 8 (Jessie); the text changed 5 times.

  1. 8
  2. 9
  3. 10
  4. 11
  5. 12
  6. 13

From libcatmandu-perl 1.2024-1 in Debian 13 (Trixie). Parsed by carta from the page's man source.