2 package Moose::Meta::Role;
8 use Scalar::Util 'blessed';
10 use Devel::GlobalDestruction 'in_global_destruction';
12 use Moose::Meta::Class;
13 use Moose::Meta::Role::Attribute;
14 use Moose::Meta::Role::Method;
15 use Moose::Meta::Role::Method::Required;
16 use Moose::Meta::Role::Method::Conflicting;
17 use Moose::Meta::Method::Meta;
18 use Moose::Util qw( ensure_all_roles );
19 use Class::MOP::MiniTrait;
21 use base 'Class::MOP::Module',
22 'Class::MOP::Mixin::HasAttributes',
23 'Class::MOP::Mixin::HasMethods';
25 Class::MOP::MiniTrait::apply(__PACKAGE__, 'Moose::Meta::Object::Trait');
27 ## ------------------------------------------------------------------
29 ## I normally don't do this, but I am doing
30 ## a whole bunch of meta-programmin in this
31 ## module, so it just makes sense. For a clearer
32 ## picture of what is going on in the next
33 ## several lines of code, look at the really
34 ## big comment at the end of this file (right
37 ## ------------------------------------------------------------------
39 my $META = __PACKAGE__->meta;
41 ## ------------------------------------------------------------------
45 # since roles are lazy, we hold all the attributes
46 # of the individual role in 'statis' until which
47 # time when it is applied to a class. This means
48 # keeping a lot of things in hash maps, so we are
49 # using a little of that meta-programmin' magic
50 # here an saving lots of extra typin. And since
51 # many of these attributes above require similar
52 # functionality to support them, so we again use
53 # the wonders of meta-programmin' to deliver a
54 # very compact solution to this normally verbose
60 name => 'excluded_roles_map',
61 attr_reader => 'get_excluded_roles_map' ,
63 add => 'add_excluded_roles',
64 get_keys => 'get_excluded_roles_list',
65 existence => 'excludes_role',
69 name => 'required_methods',
70 attr_reader => 'get_required_methods_map',
72 remove => 'remove_required_methods',
73 get_values => 'get_required_method_list',
74 existence => 'requires_method',
79 my $attr_reader = $action->{attr_reader};
80 my $methods = $action->{methods};
82 # create the attribute
83 $META->add_attribute($action->{name} => (
84 reader => $attr_reader,
88 # create some helper methods
89 $META->add_method($methods->{add} => sub {
90 my ($self, @values) = @_;
91 $self->$attr_reader->{$_} = undef foreach @values;
92 }) if exists $methods->{add};
94 $META->add_method($methods->{get_keys} => sub {
96 keys %{$self->$attr_reader};
97 }) if exists $methods->{get_keys};
99 $META->add_method($methods->{get_values} => sub {
101 values %{$self->$attr_reader};
102 }) if exists $methods->{get_values};
104 $META->add_method($methods->{get} => sub {
105 my ($self, $name) = @_;
106 $self->$attr_reader->{$name}
107 }) if exists $methods->{get};
109 $META->add_method($methods->{existence} => sub {
110 my ($self, $name) = @_;
111 exists $self->$attr_reader->{$name} ? 1 : 0;
112 }) if exists $methods->{existence};
114 $META->add_method($methods->{remove} => sub {
115 my ($self, @values) = @_;
116 delete $self->$attr_reader->{$_} foreach @values;
117 }) if exists $methods->{remove};
120 $META->add_attribute(
122 reader => 'method_metaclass',
123 default => 'Moose::Meta::Role::Method',
126 $META->add_attribute(
127 'required_method_metaclass',
128 reader => 'required_method_metaclass',
129 default => 'Moose::Meta::Role::Method::Required',
132 $META->add_attribute(
133 'conflicting_method_metaclass',
134 reader => 'conflicting_method_metaclass',
135 default => 'Moose::Meta::Role::Method::Conflicting',
138 $META->add_attribute(
139 'application_to_class_class',
140 reader => 'application_to_class_class',
141 default => 'Moose::Meta::Role::Application::ToClass',
144 $META->add_attribute(
145 'application_to_role_class',
146 reader => 'application_to_role_class',
147 default => 'Moose::Meta::Role::Application::ToRole',
150 $META->add_attribute(
151 'application_to_instance_class',
152 reader => 'application_to_instance_class',
153 default => 'Moose::Meta::Role::Application::ToInstance',
156 $META->add_attribute(
157 'applied_attribute_metaclass',
158 reader => 'applied_attribute_metaclass',
159 default => 'Moose::Meta::Attribute',
162 # More or less copied from Moose::Meta::Class
166 unshift @args, 'package' if @args % 2;
168 my $package = delete $opts{package};
169 return Class::MOP::get_metaclass_by_name($package)
170 || $class->SUPER::initialize($package,
171 'attribute_metaclass' => 'Moose::Meta::Role::Attribute',
180 my $meta = blessed $pkg ? $pkg : Class::MOP::class_of($pkg);
182 my %existing_classes;
184 %existing_classes = map { $_ => $meta->$_() } qw(
187 wrapped_method_metaclass
188 required_method_metaclass
189 conflicting_method_metaclass
190 application_to_class_class
191 application_to_role_class
192 application_to_instance_class
193 applied_attribute_metaclass
198 $options{weaken} = Class::MOP::metaclass_is_weak($meta->name)
199 if !exists $options{weaken}
201 && $meta->isa('Moose::Meta::Role');
203 # don't need to remove generated metaobjects here yet, since we don't
204 # yet generate anything in roles. this may change in the future though...
205 # keep an eye on that
206 my $new_meta = $self->SUPER::reinitialize(
211 $new_meta->_restore_metaobjects_from($meta)
212 if $meta && $meta->isa('Moose::Meta::Role');
216 sub _restore_metaobjects_from {
220 $self->_restore_metamethods_from($old_meta);
221 $self->_restore_metaattributes_from($old_meta);
223 for my $role ( @{ $old_meta->get_roles } ) {
224 $self->add_role($role);
231 if (blessed $_[0] && ! $_[0]->isa('Moose::Meta::Role::Attribute') ) {
232 my $class = ref $_[0];
233 Moose->throw_error( "Cannot add a $class as an attribute to a role" );
235 elsif (!blessed($_[0]) && defined($_[0]) && $_[0] =~ /^\+(.*)/) {
236 Moose->throw_error( "has '+attr' is not supported in roles" );
239 return $self->SUPER::add_attribute(@_);
242 sub _attach_attribute {
243 my ( $self, $attribute ) = @_;
245 $attribute->attach_to_role($self);
248 sub add_required_methods {
253 if (!blessed($method)) {
254 $method = $self->required_method_metaclass->new(
258 $self->get_required_methods_map->{$method->name} = $method;
262 sub add_conflicting_method {
266 if (@_ == 1 && blessed($_[0])) {
270 $method = $self->conflicting_method_metaclass->new(@_);
273 $self->add_required_methods($method);
276 ## ------------------------------------------------------------------
280 # the before/around/after method modifiers are
281 # stored by name, but there can be many methods
282 # then associated with that name. So again we have
283 # lots of similar functionality, so we can do some
284 # meta-programmin' and save some time.
287 foreach my $modifier_type (qw[ before around after ]) {
289 my $attr_reader = "get_${modifier_type}_method_modifiers_map";
291 # create the attribute ...
292 $META->add_attribute("${modifier_type}_method_modifiers" => (
293 reader => $attr_reader,
294 default => sub { {} }
297 # and some helper methods ...
298 $META->add_method("get_${modifier_type}_method_modifiers" => sub {
299 my ($self, $method_name) = @_;
300 #return () unless exists $self->$attr_reader->{$method_name};
301 my $mm = $self->$attr_reader->{$method_name};
305 $META->add_method("has_${modifier_type}_method_modifiers" => sub {
306 my ($self, $method_name) = @_;
308 # for now we assume that if it exists,..
309 # it has at least one modifier in it
310 (exists $self->$attr_reader->{$method_name}) ? 1 : 0;
313 $META->add_method("add_${modifier_type}_method_modifier" => sub {
314 my ($self, $method_name, $method) = @_;
316 $self->$attr_reader->{$method_name} = []
317 unless exists $self->$attr_reader->{$method_name};
319 my $modifiers = $self->$attr_reader->{$method_name};
322 # check to see that we aren't adding the
323 # same code twice. We err in favor of the
324 # first on here, this may not be as expected
325 foreach my $modifier (@{$modifiers}) {
326 return if $modifier == $method;
329 push @{$modifiers} => $method;
334 ## ------------------------------------------------------------------
335 ## override method mofidiers
337 $META->add_attribute('override_method_modifiers' => (
338 reader => 'get_override_method_modifiers_map',
339 default => sub { {} }
343 # these are a little different because there
344 # can only be one per name, whereas the other
345 # method modifiers can have multiples.
348 sub add_override_method_modifier {
349 my ($self, $method_name, $method) = @_;
350 (!$self->has_method($method_name))
351 || Moose->throw_error("Cannot add an override of method '$method_name' " .
352 "because there is a local version of '$method_name'");
353 $self->get_override_method_modifiers_map->{$method_name} = $method;
356 sub has_override_method_modifier {
357 my ($self, $method_name) = @_;
359 # for now we assume that if it exists,..
360 # it has at least one modifier in it
361 (exists $self->get_override_method_modifiers_map->{$method_name}) ? 1 : 0;
364 sub get_override_method_modifier {
365 my ($self, $method_name) = @_;
366 $self->get_override_method_modifiers_map->{$method_name};
369 ## general list accessor ...
371 sub get_method_modifier_list {
372 my ($self, $modifier_type) = @_;
373 my $accessor = "get_${modifier_type}_method_modifiers_map";
374 keys %{$self->$accessor};
377 sub _meta_method_class { 'Moose::Meta::Method::Meta' }
379 ## ------------------------------------------------------------------
382 $META->add_attribute('roles' => (
383 reader => 'get_roles',
384 default => sub { [] }
388 my ($self, $role) = @_;
389 (blessed($role) && $role->isa('Moose::Meta::Role'))
390 || Moose->throw_error("Roles must be instances of Moose::Meta::Role");
391 push @{$self->get_roles} => $role;
392 $self->reset_package_cache_flag;
395 sub calculate_all_roles {
401 $_->calculate_all_roles
402 } @{ $self->get_roles });
406 my ($self, $role) = @_;
408 || Moose->throw_error("You must supply a role name to look for");
409 my $role_name = blessed $role ? $role->name : $role;
410 # if we are it,.. then return true
411 return 1 if $role_name eq $self->name;
412 # otherwise.. check our children
413 foreach my $role (@{$self->get_roles}) {
414 return 1 if $role->does_role($role_name);
419 sub find_method_by_name { (shift)->get_method(@_) }
421 ## ------------------------------------------------------------------
423 ## ------------------------------------------------------------------
426 my ($self, $other, %args) = @_;
429 || Moose->throw_error("You must pass in an blessed instance");
431 my $application_class;
432 if ($other->isa('Moose::Meta::Role')) {
433 $application_class = $self->application_to_role_class;
435 elsif ($other->isa('Moose::Meta::Class')) {
436 $application_class = $self->application_to_class_class;
439 $application_class = $self->application_to_instance_class;
442 Class::MOP::load_class($application_class);
444 my $deprecation_check = 0;
446 if ( exists $args{excludes} && !exists $args{'-excludes'} ) {
447 $args{'-excludes'} = delete $args{excludes};
448 $deprecation_check = 1;
450 if ( exists $args{alias} && !exists $args{'-alias'} ) {
451 $args{'-alias'} = delete $args{alias};
452 $deprecation_check = 1;
455 if ( $deprecation_check ) {
456 Moose::Deprecated::deprecated(
457 feature => 'alias or excludes',
459 'The alias and excludes options for role application'.
460 ' have been renamed -alias and -excludes'.
461 " (${\$other->name} is consuming ${\$self->name}".
462 " - do you need to upgrade ${\$other->name}?).".
463 ' This will be an error in Moose 2.0200.'
467 if ( exists $args{'-excludes'} ) {
468 # I wish we had coercion here :)
469 $args{'-excludes'} = (
470 ref $args{'-excludes'} eq 'ARRAY'
472 : [ $args{'-excludes'} ]
476 return $application_class->new(%args)->apply($self, $other, \%args);
479 sub composition_class_roles { }
482 my ($class, @role_specs) = @_;
484 require Moose::Meta::Role::Composite;
486 my (@roles, %role_params);
487 while (@role_specs) {
488 my ($role, $params) = @{ splice @role_specs, 0, 1 };
492 : Class::MOP::class_of($role);
494 my $actual_role = $requested_role->_role_for_combination($params);
495 push @roles => $actual_role;
497 next unless defined $params;
498 $role_params{$actual_role->name} = $params;
501 my $c = Moose::Meta::Role::Composite->new(roles => \@roles);
502 return $c->apply_params(\%role_params);
505 sub _role_for_combination {
506 my ($self, $params) = @_;
514 unshift @args, 'package' if @args % 2 == 1;
517 (ref $options{attributes} eq 'HASH')
518 || confess "You must pass a HASH ref of attributes"
519 if exists $options{attributes};
521 (ref $options{methods} eq 'HASH')
522 || confess "You must pass a HASH ref of methods"
523 if exists $options{methods};
525 (ref $options{roles} eq 'ARRAY')
526 || confess "You must pass an ARRAY ref of roles"
527 if exists $options{roles};
529 my $package = delete $options{package};
530 my $roles = delete $options{roles};
531 my $attributes = delete $options{attributes};
532 my $methods = delete $options{methods};
533 my $meta_name = exists $options{meta_name}
534 ? delete $options{meta_name}
537 my $meta = $class->SUPER::create($package => %options);
539 $meta->_add_meta_method($meta_name)
540 if defined $meta_name;
542 if (defined $attributes) {
543 foreach my $attribute_name (keys %{$attributes}) {
544 my $attr = $attributes->{$attribute_name};
545 $meta->add_attribute(
546 $attribute_name => blessed $attr ? $attr : %{$attr} );
550 if (defined $methods) {
551 foreach my $method_name (keys %{$methods}) {
552 $meta->add_method($method_name, $methods->{$method_name});
557 Moose::Util::apply_all_roles($meta, @$roles);
566 for my $meta (Class::MOP::get_all_metaclass_instances) {
567 next if $meta->name eq $self->name;
568 next unless $meta->isa('Moose::Meta::Class')
569 || $meta->isa('Moose::Meta::Role');
570 push @consumers, $meta->name
571 if $meta->does_role($self->name);
576 # XXX: something more intelligent here?
577 sub _anon_package_prefix { 'Moose::Meta::Role::__ANON__::SERIAL::' }
579 sub create_anon_role { shift->create_anon(@_) }
580 sub is_anon_role { shift->is_anon(@_) }
582 sub _anon_cache_key {
586 # XXX fix this duplication (see MMC::_anon_cache_key
587 my $roles = Data::OptList::mkopt(($options{roles} || []), {
589 val_test => sub { ref($_[0]) eq 'HASH' },
593 for my $role_spec (@$roles) {
594 my ($role, $params) = @$role_spec;
595 $params = { %$params };
597 my $key = blessed($role) ? $role->name : $role;
599 if ($params && %$params) {
600 my $alias = delete $params->{'-alias'}
601 || delete $params->{'alias'}
603 my $excludes = delete $params->{'-excludes'}
604 || delete $params->{'excludes'}
606 $excludes = [$excludes] unless ref($excludes) eq 'ARRAY';
609 warn "Roles with parameters cannot be cached. Consider "
610 . "applying the parameters before calling "
611 . "create_anon_class, or using 'weaken => 0' instead";
615 $key .= '<' . join('+', 'a', join('%', %$alias),
616 'e', join('%', @$excludes)) . '>';
619 push @role_keys, $key;
622 # Makes something like Role|Role::1
623 return join('|', @role_keys);
626 #####################################################################
628 ## This is Moose::Meta::Role as defined by Moose (plus the use of
629 ## MooseX::AttributeHelpers module). It is here as a reference to
630 ## make it easier to see what is happening above with all the meta
632 #####################################################################
635 # metaclass => 'Array',
636 # reader => 'get_roles',
637 # isa => 'ArrayRef[Moose::Meta::Role]',
638 # default => sub { [] },
640 # 'push' => 'add_role',
644 # has 'excluded_roles_map' => (
645 # metaclass => 'Hash',
646 # reader => 'get_excluded_roles_map',
647 # isa => 'HashRef[Str]',
649 # # Not exactly set, cause it sets multiple
650 # 'set' => 'add_excluded_roles',
651 # 'keys' => 'get_excluded_roles_list',
652 # 'exists' => 'excludes_role',
656 # has 'required_methods' => (
657 # metaclass => 'Hash',
658 # reader => 'get_required_methods_map',
659 # isa => 'HashRef[Moose::Meta::Role::Method::Required]',
661 # # not exactly set, or delete since it works for multiple
662 # 'set' => 'add_required_methods',
663 # 'delete' => 'remove_required_methods',
664 # 'keys' => 'get_required_method_list',
665 # 'exists' => 'requires_method',
669 # # the before, around and after modifiers are
670 # # HASH keyed by method-name, with ARRAY of
671 # # CODE refs to apply in that order
673 # has 'before_method_modifiers' => (
674 # metaclass => 'Hash',
675 # reader => 'get_before_method_modifiers_map',
676 # isa => 'HashRef[ArrayRef[CodeRef]]',
678 # 'keys' => 'get_before_method_modifiers',
679 # 'exists' => 'has_before_method_modifiers',
680 # # This actually makes sure there is an
681 # # ARRAY at the given key, and pushed onto
682 # # it. It also checks for duplicates as well
683 # # 'add' => 'add_before_method_modifier'
687 # has 'after_method_modifiers' => (
688 # metaclass => 'Hash',
689 # reader =>'get_after_method_modifiers_map',
690 # isa => 'HashRef[ArrayRef[CodeRef]]',
692 # 'keys' => 'get_after_method_modifiers',
693 # 'exists' => 'has_after_method_modifiers',
694 # # This actually makes sure there is an
695 # # ARRAY at the given key, and pushed onto
696 # # it. It also checks for duplicates as well
697 # # 'add' => 'add_after_method_modifier'
701 # has 'around_method_modifiers' => (
702 # metaclass => 'Hash',
703 # reader =>'get_around_method_modifiers_map',
704 # isa => 'HashRef[ArrayRef[CodeRef]]',
706 # 'keys' => 'get_around_method_modifiers',
707 # 'exists' => 'has_around_method_modifiers',
708 # # This actually makes sure there is an
709 # # ARRAY at the given key, and pushed onto
710 # # it. It also checks for duplicates as well
711 # # 'add' => 'add_around_method_modifier'
715 # # override is similar to the other modifiers
716 # # except that it is not an ARRAY of code refs
717 # # but instead just a single name->code mapping
719 # has 'override_method_modifiers' => (
720 # metaclass => 'Hash',
721 # reader =>'get_override_method_modifiers_map',
722 # isa => 'HashRef[CodeRef]',
724 # 'keys' => 'get_override_method_modifier',
725 # 'exists' => 'has_override_method_modifier',
726 # 'add' => 'add_override_method_modifier', # checks for local method ..
730 #####################################################################
735 # ABSTRACT: The Moose Role metaclass
743 This class is a subclass of L<Class::MOP::Module> that provides
744 additional Moose-specific functionality.
746 Its API looks a lot like L<Moose::Meta::Class>, but internally it
747 implements many things differently. This may change in the future.
751 C<Moose::Meta::Role> is a subclass of L<Class::MOP::Module>.
759 =item B<< Moose::Meta::Role->initialize($role_name) >>
761 This method creates a new role object with the provided name.
763 =item B<< Moose::Meta::Role->combine( [ $role => { ... } ], [ $role ], ... ) >>
765 This method accepts a list of array references. Each array reference
766 should contain a role name or L<Moose::Meta::Role> object as its first element. The second element is
767 an optional hash reference. The hash reference can contain C<-excludes>
768 and C<-alias> keys to control how methods are composed from the role.
770 The return value is a new L<Moose::Meta::Role::Composite> that
771 represents the combined roles.
773 =item B<< $metarole->composition_class_roles >>
775 When combining multiple roles using C<combine>, this method is used to obtain a
776 list of role names to be applied to the L<Moose::Meta::Role::Composite>
777 instance returned by C<combine>. The default implementation returns an empty
778 list. Extensions that need to hook into role combination may wrap this method
779 to return additional role names.
781 =item B<< Moose::Meta::Role->create($name, %options) >>
783 This method is identical to the L<Moose::Meta::Class> C<create>
786 =item B<< Moose::Meta::Role->create_anon_role >>
788 This method is identical to the L<Moose::Meta::Class>
789 C<create_anon_class> method.
791 =item B<< $metarole->is_anon_role >>
793 Returns true if the role is an anonymous role.
795 =item B<< $metarole->consumers >>
797 Returns a list of names of classes and roles which consume this role.
801 =head2 Role application
805 =item B<< $metarole->apply( $thing, @options ) >>
807 This method applies a role to the given C<$thing>. That can be another
808 L<Moose::Meta::Role>, object, a L<Moose::Meta::Class> object, or a
809 (non-meta) object instance.
811 The options are passed directly to the constructor for the appropriate
812 L<Moose::Meta::Role::Application> subclass.
814 Note that this will apply the role even if the C<$thing> in question already
815 C<does> this role. L<Moose::Util/does_role> is a convenient wrapper for
816 finding out if role application is necessary.
820 =head2 Roles and other roles
824 =item B<< $metarole->get_roles >>
826 This returns an array reference of roles which this role does. This
827 list may include duplicates.
829 =item B<< $metarole->calculate_all_roles >>
831 This returns a I<unique> list of all roles that this role does, and
832 all the roles that its roles do.
834 =item B<< $metarole->does_role($role) >>
836 Given a role I<name> or L<Moose::Meta::Role> object, returns true if this role
839 =item B<< $metarole->add_role($role) >>
841 Given a L<Moose::Meta::Role> object, this adds the role to the list of
842 roles that the role does.
844 =item B<< $metarole->get_excluded_roles_list >>
846 Returns a list of role names which this role excludes.
848 =item B<< $metarole->excludes_role($role_name) >>
850 Given a role I<name>, returns true if this role excludes the named
853 =item B<< $metarole->add_excluded_roles(@role_names) >>
855 Given one or more role names, adds those roles to the list of excluded
862 The methods for dealing with a role's methods are all identical in API
863 and behavior to the same methods in L<Class::MOP::Class>.
867 =item B<< $metarole->method_metaclass >>
869 Returns the method metaclass name for the role. This defaults to
870 L<Moose::Meta::Role::Method>.
872 =item B<< $metarole->get_method($name) >>
874 =item B<< $metarole->has_method($name) >>
876 =item B<< $metarole->add_method( $name, $body ) >>
878 =item B<< $metarole->get_method_list >>
880 =item B<< $metarole->find_method_by_name($name) >>
882 These methods are all identical to the methods of the same name in
883 L<Class::MOP::Package>
889 As with methods, the methods for dealing with a role's attribute are
890 all identical in API and behavior to the same methods in
891 L<Class::MOP::Class>.
893 However, attributes stored in this class are I<not> stored as
894 objects. Rather, the attribute definition is stored as a hash
895 reference. When a role is composed into a class, this hash reference
896 is passed directly to the metaclass's C<add_attribute> method.
898 This is quite likely to change in the future.
902 =item B<< $metarole->get_attribute($attribute_name) >>
904 =item B<< $metarole->has_attribute($attribute_name) >>
906 =item B<< $metarole->get_attribute_list >>
908 =item B<< $metarole->add_attribute($name, %options) >>
910 =item B<< $metarole->remove_attribute($attribute_name) >>
914 =head2 Required methods
918 =item B<< $metarole->get_required_method_list >>
920 Returns the list of methods required by the role.
922 =item B<< $metarole->requires_method($name) >>
924 Returns true if the role requires the named method.
926 =item B<< $metarole->add_required_methods(@names) >>
928 Adds the named methods to the role's list of required methods.
930 =item B<< $metarole->remove_required_methods(@names) >>
932 Removes the named methods from the role's list of required methods.
934 =item B<< $metarole->add_conflicting_method(%params) >>
936 Instantiate the parameters as a L<Moose::Meta::Role::Method::Conflicting>
937 object, then add it to the required method list.
941 =head2 Method modifiers
943 These methods act like their counterparts in L<Class::MOP::Class> and
944 L<Moose::Meta::Class>.
946 However, method modifiers are simply stored internally, and are not
947 applied until the role itself is applied to a class.
951 =item B<< $metarole->add_after_method_modifier($method_name, $method) >>
953 =item B<< $metarole->add_around_method_modifier($method_name, $method) >>
955 =item B<< $metarole->add_before_method_modifier($method_name, $method) >>
957 =item B<< $metarole->add_override_method_modifier($method_name, $method) >>
959 These methods all add an appropriate modifier to the internal list of
962 =item B<< $metarole->has_after_method_modifiers >>
964 =item B<< $metarole->has_around_method_modifiers >>
966 =item B<< $metarole->has_before_method_modifiers >>
968 =item B<< $metarole->has_override_method_modifier >>
970 Return true if the role has any modifiers of the given type.
972 =item B<< $metarole->get_after_method_modifiers($method_name) >>
974 =item B<< $metarole->get_around_method_modifiers($method_name) >>
976 =item B<< $metarole->get_before_method_modifiers($method_name) >>
978 Given a method name, returns a list of the appropriate modifiers for
981 =item B<< $metarole->get_override_method_modifier($method_name) >>
983 Given a method name, returns the override method modifier for that
984 method, if it has one.
992 =item B<< Moose::Meta::Role->meta >>
994 This will return a L<Class::MOP::Class> instance for this class.
1000 See L<Moose/BUGS> for details on reporting bugs.