Package Info

perl-MooseX-Role-Parameterized


Moose roles with composition parameters


Development/Libraries/Perl

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 Moose/has. You can use any option that Moose/has 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 Moose/with. 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.

See MooseX::Role::Parameterized::Extending for some tips on how to extend this module.


License: Artistic-1.0 OR GPL-1.0-or-later
URL: https://metacpan.org/release/MooseX-Role-Parameterized

Categories

Releases

Package Version Update ID Released Package Hub Version Platforms Subpackages
1.11-bp156.3.1 info GA Release 2023-07-22 15 SP6
  • AArch64
  • ppc64le
  • s390x
  • x86-64
  • perl-MooseX-Role-Parameterized
1.11-bp155.2.9 info GA Release 2023-05-17 15 SP5
  • AArch64
  • ppc64le
  • s390x
  • x86-64
  • perl-MooseX-Role-Parameterized
1.11-bp154.1.14 info GA Release 2022-05-09 15 SP4
  • AArch64
  • ppc64le
  • s390x
  • x86-64
  • perl-MooseX-Role-Parameterized
1.10-bp153.1.13 info GA Release 2021-03-06 15 SP3
  • AArch64
  • ppc64le
  • s390x
  • x86-64
  • perl-MooseX-Role-Parameterized
1.10-bp152.3.13 info GA Release 2020-04-17 15 SP2
  • AArch64
  • ppc64le
  • s390x
  • x86-64
  • perl-MooseX-Role-Parameterized
1.10-bp151.3.1 info GA Release 2019-07-16 15 SP1
  • AArch64
  • ppc64le
  • s390x
  • x86-64
  • perl-MooseX-Role-Parameterized
1.10-bp151.2.11 info GA Release 2019-05-18 15 SP1
  • AArch64
  • ppc64le
  • s390x
  • x86-64
  • perl-MooseX-Role-Parameterized
1.10-bp150.2.4 info GA Release 2018-07-30 15
  • AArch64
  • ppc64le
  • s390x
  • x86-64
  • perl-MooseX-Role-Parameterized