The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

MooseX::Role::Callback

SYNOPSIS

    package Foo;

    use Moose::Role;
    use MooseX::Role::Callback;

    included(sub {
        my ($meta, $user) = @_;
        print "Foo applied to " . $user->name . "\n";
    });

    package Bar;

    use Moose;
    with 'Foo'; # Prints "Foo applied to Bar"

DESCRIPTION

Execute a callback function when a role is applied.

FUNCTIONS

included

Registers a function to be called when the role is applied. Takes a single coderef as an argument.

The function will be passed the role's metaclass and the $thing's metaclass, where $thing can be either class or instance.

Call multiple times to register multiple callbacks.

GITHUB

Find this project on github:

https://github.com/pboyd/MooseX-Role-Callback

AUTHOR

Paul Boyd <pboyd@cpan.org>

COPYRIGHT AND LICENSE

This software is copyright (c) 2012 by Paul Boyd.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.