MooseX::Role::Parameterized::Meta::Trait::Parameterizable - trait for parameterizable roles



NAME

MooseX::Role::Parameterized::Meta::Trait::Parameterizable - trait for parameterizable roles


VERSION

version 1.08


DESCRIPTION

This is the trait that is applied to the metaclass for parameterizable roles, roles that have their parameters currently unbound. These are the roles that you use Moose/with, but instead of composing the parameterizable role, we construct a new parameterized role (the MooseX::Role::Parameterized::Meta::Role::Parameterized manpage) and use that new parameterized role instead.


ATTRIBUTES

parameterized_role_metaclass

The name of the class that will be used to construct the parameterized role.

parameters_class

The name of the class that will be used to construct the parameters object.

parameters_metaclass

A metaclass representing this role's parameters. It will be an anonymous subclass of parameters_class. Each call to parameter in the MooseX::Role::Parameters manpage adds an attribute to this metaclass.

When this role is consumed, the parameters object will be instantiated using this metaclass.

role_generator

A code reference that is used to generate a role based on the parameters provided by the consumer. The user usually specifies it using the role in the MooseX::Role::Parameterized manpage keyword.


METHODS

add_parameter $name, %options

Delegates to add_attribute in the Moose::Meta::Class manpage on the parameters_metaclass object.

construct_parameters %arguments

Creates a new the MooseX::Role::Parameterized::Parameters manpage object using metaclass parameters_metaclass.

The arguments are those specified by the consumer as parameter values.

generate_role %arguments

This method generates and returns a new instance of parameterized_role_metaclass. It can take any combination of three named arguments:

parameters
A hashref of parameters for the role, same as would be passed in at a ``with'' statement.

package
A package name that, if present, we will use for the generated role; if not, we generate an anonymous role.

consumer

A consumer metaobject, if available.

apply

Overrides apply in the Moose::Meta::Role manpage to automatically generate the parameterized role.


AUTHOR

Shawn M Moore <code@sartak.org>


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.

 MooseX::Role::Parameterized::Meta::Trait::Parameterizable - trait for parameterizable roles