Please login to access the resource

Roles with composition parameters

Edit Package perl-MooseX-Role-Parameterized
http://search.cpan.org/dist/MooseX-Role-Parameterized/

Your parameterized role consists of two new things: parameter declarations and
a role block.

Parameters are declared using the "parameter" keyword which very much resembles
"has" in Moose. You can use any option that "has" in Moose accepts. The default
value for the is option is ro as that's a very common case. Use is => 'bare' if
you want no accessor. These parameters will get their values when the consuming
class (or role) uses "with" in Moose. A parameter object will be constructed
with these values, and passed to the role block.

The role block then uses the usual Moose::Role keywords to build up a role. You
can shift off the parameter object to inspect what the consuming class provided
as parameters. You use the parameters to customize your role however you wish.

There are many possible implementations for parameterized roles (hopefully with
a consistent enough API); I believe this to be the easiest and most flexible
design. Coincidentally, Pugs originally had an eerily similar design.

Refresh
Refresh
Source Files
Filename Size Changed
MooseX-Role-Parameterized-0.27.tar.gz 0000034411 33.6 KB
perl-MooseX-Role-Parameterized-old_Test_More.patch 0000001153 1.13 KB
perl-MooseX-Role-Parameterized.changes 0000002035 1.99 KB
perl-MooseX-Role-Parameterized.spec 0000003181 3.11 KB
Revision 14 (latest revision is 28)
Stephan Kulow's avatar Stephan Kulow (coolo) committed (revision 14)
- update to 0.27 
    * Remove MooseX::Role::Parameterized::Meta::Parameter; instead,
      the default for parameters of (is => 'ro') is set by the
      "parameter" sugar. This removes an unnecessary metaclass and
      removes weird edge cases caused by it. Please please please
      report any breakage!
Comments 0
openSUSE Build Service is sponsored by