Skip to content

Instantly share code, notes, and snippets.

@berekuk
Created February 28, 2012 13:23
Show Gist options
  • Select an option

  • Save berekuk/1932537 to your computer and use it in GitHub Desktop.

Select an option

Save berekuk/1932537 to your computer and use it in GitHub Desktop.
MooseX::DOES module proposal
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