MooX::Role::Parameterized::With::Keyword - DSL to apply roles with composition parameters
This document describes version 0.001 of MooX::Role::Parameterized::With::Keyword (from Perl distribution MooX-Role-Parameterized-With-Keyword), released on 2018-10-11.
This module is a temporary alternative to MooX::Role::Parameterized::With and provides with keyword. In addition to that, this module can include Role::Tiny and regular non-parametric Moo::Role roles.
with
In MyRole1.pm:
package Role1; # a Role::Tiny role use Role::Tiny; sub meth1 { ... } 1;
In MyRole2.pm:
package Role2; # a Moo::Role role use Moo::Role; sub meth2 { ... } 1;
In MyRole3.pm:
package MyRole3; # a parameterized Moo::Role role use MooX::Role::Parameterized; role { my ($params, $mop) = @_; $mop->method($params->{name} => sub {...}); }; 1;
In MyClass.pm, which uses the roles:
package MyClass; use MooX::Role::Parameterized::With::Keyword; with 'MyRole1', 'MyRole2', 'MyRole3' => {name => 'meth3_blah'};
In script.pl, which uses the class:
use MyClass; my $obj = MyClass->new; $obj->meth1; $obj->meth2; $obj->meth3_blah;
Please visit the project's homepage at https://metacpan.org/release/MooX-Role-Parameterized-With-Keyword.
Source repository is at https://github.com/perlancar/perl-MooX-Role-Parameterized-With-Keyword.
Please report any bugs or feature requests on the bugtracker website https://rt.cpan.org/Public/Dist/Display.html?Name=MooX-Role-Parameterized-With-Keyword
When submitting a bug or request, please include a test-file or a patch to an existing test-file that illustrates the bug or desired feature.
MooX::Role::Parameterized
https://github.com/peczenyj/MooX-Role-Parameterized/pull/6
https://github.com/peczenyj/MooX-Role-Parameterized/pull/7
perlancar <perlancar@cpan.org>
This software is copyright (c) 2018 by perlancar@cpan.org.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
To install MooX::Role::Parameterized::With::Keyword, copy and paste the appropriate command in to your terminal.
cpanm
cpanm MooX::Role::Parameterized::With::Keyword
CPAN shell
perl -MCPAN -e shell install MooX::Role::Parameterized::With::Keyword
For more information on module installation, please visit the detailed CPAN module installation guide.