# PODNAME: MooseX::Role::Parameterized::Extending # ABSTRACT: extending MooseX::Role::Parameterized roles __END__ =pod =encoding UTF-8 =head1 NAME MooseX::Role::Parameterized::Extending - extending MooseX::Role::Parameterized roles =head1 VERSION version 1.11 =head1 DESCRIPTION There are heaps of useful modules in the C namespace that you can use to make your roles more powerful. However, they do not always work out of the box with L, but it's fairly straight-forward to achieve the functionality you desire. L was designed to be as extensible as the rest of L, and as such it is possible to apply custom traits to both the parameterizable role or the ordinary roles they generate. In this example, we will look at applying the fake trait C to a parameterizable role. First we need to define a new metaclass for our parameterizable role. package MyApp::Meta::Role::Parameterizable; use Moose; extends 'MooseX::Role::Parameterized::Meta::Role::Parameterizable'; with 'MooseX::MagicRole'; This is a class (observe that it uses L, not L) which extends the class which governs parameterizable roles. L is the metaclass that packages using L receive by default. Note that the class we are extending, L>|MooseX::Role::Parameterized::Meta::Role::Parameterizable>, is entirely distinct from the similarly-named class which governs the ordinary roles that parameterized roles generate. An instance of L>|MooseX::Role::Parameterized> represents a role with its parameters already bound. Now we can take advantage of our new subclass by specifying that we want to use C as our metaclass when importing L: package MyApp::Role; use MooseX::Role::Parameterized -metaclass => 'MyApp::Meta::Role::Parameterizable'; role { ... } And there you go! C now has the C trait applied. =head1 NAME =head1 SUPPORT Bugs may be submitted through L (or L). There is also a mailing list available for users of this distribution, at L. There is also an irc channel available for users of this distribution, at L on C|irc://irc.perl.org/#moose>. =head1 AUTHOR Shawn M Moore =head1 COPYRIGHT AND LICENSE This software is copyright (c) 2008 by Shawn M Moore. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. =cut