Created
February 28, 2012 13:23
-
-
Save berekuk/1932537 to your computer and use it in GitHub Desktop.
MooseX::DOES module proposal
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package R; | |
| use Moose::Role; | |
| # My::Role::Foo is just a string which affects DOES() behaviour, nothing else | |
| # plan for implementation: | |
| # 1) add MX::Does::Role role to R which wraps DOES with around DOES => sub { ... } | |
| # 2) call $role_metaclass->add_attribute('additional_DOES', ...) | |
| # 3) iterate over role metaclasses in DOES wrapper in MX::Does::Role | |
| use MooseX::DOES qw/ My::Role::Foo My::Role::Bar /; | |
| package X; | |
| use Moose; | |
| with 'R'; | |
| say X->new->DOES('My::Role::Foo'); # 1 | |
| say X->new->does('My::Role::Foo'); # 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment