2 package Moose::Meta::Role;
8 use Class::Load qw(load_class);
9 use Scalar::Util 'blessed';
11 use Devel::GlobalDestruction 'in_global_destruction';
13 use Moose::Meta::Class;
14 use Moose::Meta::Role::Attribute;
15 use Moose::Meta::Role::Method;
16 use Moose::Meta::Role::Method::Required;
17 use Moose::Meta::Role::Method::Conflicting;
18 use Moose::Meta::Method::Meta;
19 use Moose::Util qw( ensure_all_roles );
20 use Class::MOP::MiniTrait;
22 use base 'Class::MOP::Module',
23 'Class::MOP::Mixin::HasAttributes',
24 'Class::MOP::Mixin::HasMethods';
26 Class::MOP::MiniTrait::apply(__PACKAGE__, 'Moose::Meta::Object::Trait');
28 ## ------------------------------------------------------------------
30 ## I normally don't do this, but I am doing
31 ## a whole bunch of meta-programmin in this
32 ## module, so it just makes sense. For a clearer
33 ## picture of what is going on in the next
34 ## several lines of code, look at the really
35 ## big comment at the end of this file (right
38 ## ------------------------------------------------------------------
40 my $META = __PACKAGE__->meta;
42 ## ------------------------------------------------------------------
46 # since roles are lazy, we hold all the attributes
47 # of the individual role in 'statis' until which
48 # time when it is applied to a class. This means
49 # keeping a lot of things in hash maps, so we are
50 # using a little of that meta-programmin' magic
51 # here an saving lots of extra typin. And since
52 # many of these attributes above require similar
53 # functionality to support them, so we again use
54 # the wonders of meta-programmin' to deliver a
55 # very compact solution to this normally verbose
61 name => 'excluded_roles_map',
62 attr_reader => 'get_excluded_roles_map' ,
64 add => 'add_excluded_roles',
65 get_keys => 'get_excluded_roles_list',
66 existence => 'excludes_role',
70 name => 'required_methods',
71 attr_reader => 'get_required_methods_map',
73 remove => 'remove_required_methods',
74 get_values => 'get_required_method_list',
75 existence => 'requires_method',
80 my $attr_reader = $action->{attr_reader};
81 my $methods = $action->{methods};
83 # create the attribute
84 $META->add_attribute($action->{name} => (
85 reader => $attr_reader,
86 default => sub { {} },
87 Class::MOP::_definition_context(),
90 # create some helper methods
91 $META->add_method($methods->{add} => sub {
92 my ($self, @values) = @_;
93 $self->$attr_reader->{$_} = undef foreach @values;
94 }) if exists $methods->{add};
96 $META->add_method($methods->{get_keys} => sub {
98 keys %{$self->$attr_reader};
99 }) if exists $methods->{get_keys};
101 $META->add_method($methods->{get_values} => sub {
103 values %{$self->$attr_reader};
104 }) if exists $methods->{get_values};
106 $META->add_method($methods->{get} => sub {
107 my ($self, $name) = @_;
108 $self->$attr_reader->{$name}
109 }) if exists $methods->{get};
111 $META->add_method($methods->{existence} => sub {
112 my ($self, $name) = @_;
113 exists $self->$attr_reader->{$name} ? 1 : 0;
114 }) if exists $methods->{existence};
116 $META->add_method($methods->{remove} => sub {
117 my ($self, @values) = @_;
118 delete $self->$attr_reader->{$_} foreach @values;
119 }) if exists $methods->{remove};
122 $META->add_attribute(
124 reader => 'method_metaclass',
125 default => 'Moose::Meta::Role::Method',
126 Class::MOP::_definition_context(),
129 $META->add_attribute(
130 'required_method_metaclass',
131 reader => 'required_method_metaclass',
132 default => 'Moose::Meta::Role::Method::Required',
133 Class::MOP::_definition_context(),
136 $META->add_attribute(
137 'conflicting_method_metaclass',
138 reader => 'conflicting_method_metaclass',
139 default => 'Moose::Meta::Role::Method::Conflicting',
140 Class::MOP::_definition_context(),
143 $META->add_attribute(
144 'application_to_class_class',
145 reader => 'application_to_class_class',
146 default => 'Moose::Meta::Role::Application::ToClass',
147 Class::MOP::_definition_context(),
150 $META->add_attribute(
151 'application_to_role_class',
152 reader => 'application_to_role_class',
153 default => 'Moose::Meta::Role::Application::ToRole',
154 Class::MOP::_definition_context(),
157 $META->add_attribute(
158 'application_to_instance_class',
159 reader => 'application_to_instance_class',
160 default => 'Moose::Meta::Role::Application::ToInstance',
161 Class::MOP::_definition_context(),
164 $META->add_attribute(
165 'applied_attribute_metaclass',
166 reader => 'applied_attribute_metaclass',
167 default => 'Moose::Meta::Attribute',
168 Class::MOP::_definition_context(),
171 # More or less copied from Moose::Meta::Class
175 unshift @args, 'package' if @args % 2;
177 my $package = delete $opts{package};
178 return Class::MOP::get_metaclass_by_name($package)
179 || $class->SUPER::initialize($package,
180 'attribute_metaclass' => 'Moose::Meta::Role::Attribute',
189 my $meta = blessed $pkg ? $pkg : Class::MOP::class_of($pkg);
191 my %existing_classes;
193 %existing_classes = map { $_ => $meta->$_() } qw(
196 wrapped_method_metaclass
197 required_method_metaclass
198 conflicting_method_metaclass
199 application_to_class_class
200 application_to_role_class
201 application_to_instance_class
202 applied_attribute_metaclass
207 $options{weaken} = Class::MOP::metaclass_is_weak($meta->name)
208 if !exists $options{weaken}
210 && $meta->isa('Moose::Meta::Role');
212 # don't need to remove generated metaobjects here yet, since we don't
213 # yet generate anything in roles. this may change in the future though...
214 # keep an eye on that
215 my $new_meta = $self->SUPER::reinitialize(
220 $new_meta->_restore_metaobjects_from($meta)
221 if $meta && $meta->isa('Moose::Meta::Role');
225 sub _restore_metaobjects_from {
229 $self->_restore_metamethods_from($old_meta);
230 $self->_restore_metaattributes_from($old_meta);
232 for my $role ( @{ $old_meta->get_roles } ) {
233 $self->add_role($role);
240 if (blessed $_[0] && ! $_[0]->isa('Moose::Meta::Role::Attribute') ) {
241 my $class = ref $_[0];
242 Moose->throw_error( "Cannot add a $class as an attribute to a role" );
244 elsif (!blessed($_[0]) && defined($_[0]) && $_[0] =~ /^\+(.*)/) {
245 Moose->throw_error( "has '+attr' is not supported in roles" );
248 return $self->SUPER::add_attribute(@_);
251 sub _attach_attribute {
252 my ( $self, $attribute ) = @_;
254 $attribute->attach_to_role($self);
257 sub add_required_methods {
262 if (!blessed($method)) {
263 $method = $self->required_method_metaclass->new(
267 $self->get_required_methods_map->{$method->name} = $method;
271 sub add_conflicting_method {
275 if (@_ == 1 && blessed($_[0])) {
279 $method = $self->conflicting_method_metaclass->new(@_);
282 $self->add_required_methods($method);
285 ## ------------------------------------------------------------------
289 # the before/around/after method modifiers are
290 # stored by name, but there can be many methods
291 # then associated with that name. So again we have
292 # lots of similar functionality, so we can do some
293 # meta-programmin' and save some time.
296 foreach my $modifier_type (qw[ before around after ]) {
298 my $attr_reader = "get_${modifier_type}_method_modifiers_map";
300 # create the attribute ...
301 $META->add_attribute("${modifier_type}_method_modifiers" => (
302 reader => $attr_reader,
303 default => sub { {} },
304 Class::MOP::_definition_context(),
307 # and some helper methods ...
308 $META->add_method("get_${modifier_type}_method_modifiers" => sub {
309 my ($self, $method_name) = @_;
310 #return () unless exists $self->$attr_reader->{$method_name};
311 my $mm = $self->$attr_reader->{$method_name};
315 $META->add_method("has_${modifier_type}_method_modifiers" => sub {
316 my ($self, $method_name) = @_;
318 # for now we assume that if it exists,..
319 # it has at least one modifier in it
320 (exists $self->$attr_reader->{$method_name}) ? 1 : 0;
323 $META->add_method("add_${modifier_type}_method_modifier" => sub {
324 my ($self, $method_name, $method) = @_;
326 $self->$attr_reader->{$method_name} = []
327 unless exists $self->$attr_reader->{$method_name};
329 my $modifiers = $self->$attr_reader->{$method_name};
332 # check to see that we aren't adding the
333 # same code twice. We err in favor of the
334 # first on here, this may not be as expected
335 foreach my $modifier (@{$modifiers}) {
336 return if $modifier == $method;
339 push @{$modifiers} => $method;
344 ## ------------------------------------------------------------------
345 ## override method mofidiers
347 $META->add_attribute('override_method_modifiers' => (
348 reader => 'get_override_method_modifiers_map',
349 default => sub { {} },
350 Class::MOP::_definition_context(),
354 # these are a little different because there
355 # can only be one per name, whereas the other
356 # method modifiers can have multiples.
359 sub add_override_method_modifier {
360 my ($self, $method_name, $method) = @_;
361 (!$self->has_method($method_name))
362 || Moose->throw_error("Cannot add an override of method '$method_name' " .
363 "because there is a local version of '$method_name'");
364 $self->get_override_method_modifiers_map->{$method_name} = $method;
367 sub has_override_method_modifier {
368 my ($self, $method_name) = @_;
370 # for now we assume that if it exists,..
371 # it has at least one modifier in it
372 (exists $self->get_override_method_modifiers_map->{$method_name}) ? 1 : 0;
375 sub get_override_method_modifier {
376 my ($self, $method_name) = @_;
377 $self->get_override_method_modifiers_map->{$method_name};
380 ## general list accessor ...
382 sub get_method_modifier_list {
383 my ($self, $modifier_type) = @_;
384 my $accessor = "get_${modifier_type}_method_modifiers_map";
385 keys %{$self->$accessor};
388 sub _meta_method_class { 'Moose::Meta::Method::Meta' }
390 ## ------------------------------------------------------------------
393 $META->add_attribute('roles' => (
394 reader => 'get_roles',
395 default => sub { [] },
396 Class::MOP::_definition_context(),
400 my ($self, $role) = @_;
401 (blessed($role) && $role->isa('Moose::Meta::Role'))
402 || Moose->throw_error("Roles must be instances of Moose::Meta::Role");
403 push @{$self->get_roles} => $role;
404 $self->reset_package_cache_flag;
407 sub calculate_all_roles {
413 $_->calculate_all_roles
414 } @{ $self->get_roles });
418 my ($self, $role) = @_;
420 || Moose->throw_error("You must supply a role name to look for");
421 my $role_name = blessed $role ? $role->name : $role;
422 # if we are it,.. then return true
423 return 1 if $role_name eq $self->name;
424 # otherwise.. check our children
425 foreach my $role (@{$self->get_roles}) {
426 return 1 if $role->does_role($role_name);
431 sub find_method_by_name { (shift)->get_method(@_) }
433 ## ------------------------------------------------------------------
435 ## ------------------------------------------------------------------
438 my ($self, $other, %args) = @_;
441 || Moose->throw_error("You must pass in an blessed instance");
443 my $application_class;
444 if ($other->isa('Moose::Meta::Role')) {
445 $application_class = $self->application_to_role_class;
447 elsif ($other->isa('Moose::Meta::Class')) {
448 $application_class = $self->application_to_class_class;
451 $application_class = $self->application_to_instance_class;
454 load_class($application_class);
456 if ( exists $args{'-excludes'} ) {
457 # I wish we had coercion here :)
458 $args{'-excludes'} = (
459 ref $args{'-excludes'} eq 'ARRAY'
461 : [ $args{'-excludes'} ]
465 return $application_class->new(%args)->apply($self, $other, \%args);
468 sub composition_class_roles { }
471 my ($class, @role_specs) = @_;
473 require Moose::Meta::Role::Composite;
475 my (@roles, %role_params);
476 while (@role_specs) {
477 my ($role, $params) = @{ splice @role_specs, 0, 1 };
481 : Class::MOP::class_of($role);
483 my $actual_role = $requested_role->_role_for_combination($params);
484 push @roles => $actual_role;
486 next unless defined $params;
487 $role_params{$actual_role->name} = $params;
490 my $c = Moose::Meta::Role::Composite->new(roles => \@roles);
491 return $c->apply_params(\%role_params);
494 sub _role_for_combination {
495 my ($self, $params) = @_;
503 unshift @args, 'package' if @args % 2 == 1;
506 (ref $options{attributes} eq 'HASH')
507 || confess "You must pass a HASH ref of attributes"
508 if exists $options{attributes};
510 (ref $options{methods} eq 'HASH')
511 || confess "You must pass a HASH ref of methods"
512 if exists $options{methods};
514 (ref $options{roles} eq 'ARRAY')
515 || confess "You must pass an ARRAY ref of roles"
516 if exists $options{roles};
518 my $package = delete $options{package};
519 my $roles = delete $options{roles};
520 my $attributes = delete $options{attributes};
521 my $methods = delete $options{methods};
522 my $meta_name = exists $options{meta_name}
523 ? delete $options{meta_name}
526 my $meta = $class->SUPER::create($package => %options);
528 $meta->_add_meta_method($meta_name)
529 if defined $meta_name;
531 if (defined $attributes) {
532 foreach my $attribute_name (keys %{$attributes}) {
533 my $attr = $attributes->{$attribute_name};
534 $meta->add_attribute(
535 $attribute_name => blessed $attr ? $attr : %{$attr} );
539 if (defined $methods) {
540 foreach my $method_name (keys %{$methods}) {
541 $meta->add_method($method_name, $methods->{$method_name});
546 Moose::Util::apply_all_roles($meta, @$roles);
555 for my $meta (Class::MOP::get_all_metaclass_instances) {
556 next if $meta->name eq $self->name;
557 next unless $meta->isa('Moose::Meta::Class')
558 || $meta->isa('Moose::Meta::Role');
559 push @consumers, $meta->name
560 if $meta->does_role($self->name);
565 # XXX: something more intelligent here?
566 sub _anon_package_prefix { 'Moose::Meta::Role::__ANON__::SERIAL::' }
568 sub create_anon_role { shift->create_anon(@_) }
569 sub is_anon_role { shift->is_anon(@_) }
571 sub _anon_cache_key {
575 # XXX fix this duplication (see MMC::_anon_cache_key
576 my $roles = Data::OptList::mkopt(($options{roles} || []), {
578 val_test => sub { ref($_[0]) eq 'HASH' },
582 for my $role_spec (@$roles) {
583 my ($role, $params) = @$role_spec;
584 $params = { %$params };
586 my $key = blessed($role) ? $role->name : $role;
588 if ($params && %$params) {
589 my $alias = delete $params->{'-alias'}
590 || delete $params->{'alias'}
592 my $excludes = delete $params->{'-excludes'}
593 || delete $params->{'excludes'}
595 $excludes = [$excludes] unless ref($excludes) eq 'ARRAY';
598 warn "Roles with parameters cannot be cached. Consider "
599 . "applying the parameters before calling "
600 . "create_anon_class, or using 'weaken => 0' instead";
604 my $alias_key = join('%',
605 map { $_ => $alias->{$_} } sort keys %$alias
607 my $excludes_key = join('%',
610 $key .= '<' . join('+', 'a', $alias_key, 'e', $excludes_key) . '>';
613 push @role_keys, $key;
616 # Makes something like Role|Role::1
617 return join('|', sort @role_keys);
620 #####################################################################
622 ## This is Moose::Meta::Role as defined by Moose (plus the use of
623 ## MooseX::AttributeHelpers module). It is here as a reference to
624 ## make it easier to see what is happening above with all the meta
626 #####################################################################
629 # metaclass => 'Array',
630 # reader => 'get_roles',
631 # isa => 'ArrayRef[Moose::Meta::Role]',
632 # default => sub { [] },
634 # 'push' => 'add_role',
638 # has 'excluded_roles_map' => (
639 # metaclass => 'Hash',
640 # reader => 'get_excluded_roles_map',
641 # isa => 'HashRef[Str]',
643 # # Not exactly set, cause it sets multiple
644 # 'set' => 'add_excluded_roles',
645 # 'keys' => 'get_excluded_roles_list',
646 # 'exists' => 'excludes_role',
650 # has 'required_methods' => (
651 # metaclass => 'Hash',
652 # reader => 'get_required_methods_map',
653 # isa => 'HashRef[Moose::Meta::Role::Method::Required]',
655 # # not exactly set, or delete since it works for multiple
656 # 'set' => 'add_required_methods',
657 # 'delete' => 'remove_required_methods',
658 # 'keys' => 'get_required_method_list',
659 # 'exists' => 'requires_method',
663 # # the before, around and after modifiers are
664 # # HASH keyed by method-name, with ARRAY of
665 # # CODE refs to apply in that order
667 # has 'before_method_modifiers' => (
668 # metaclass => 'Hash',
669 # reader => 'get_before_method_modifiers_map',
670 # isa => 'HashRef[ArrayRef[CodeRef]]',
672 # 'keys' => 'get_before_method_modifiers',
673 # 'exists' => 'has_before_method_modifiers',
674 # # This actually makes sure there is an
675 # # ARRAY at the given key, and pushed onto
676 # # it. It also checks for duplicates as well
677 # # 'add' => 'add_before_method_modifier'
681 # has 'after_method_modifiers' => (
682 # metaclass => 'Hash',
683 # reader =>'get_after_method_modifiers_map',
684 # isa => 'HashRef[ArrayRef[CodeRef]]',
686 # 'keys' => 'get_after_method_modifiers',
687 # 'exists' => 'has_after_method_modifiers',
688 # # This actually makes sure there is an
689 # # ARRAY at the given key, and pushed onto
690 # # it. It also checks for duplicates as well
691 # # 'add' => 'add_after_method_modifier'
695 # has 'around_method_modifiers' => (
696 # metaclass => 'Hash',
697 # reader =>'get_around_method_modifiers_map',
698 # isa => 'HashRef[ArrayRef[CodeRef]]',
700 # 'keys' => 'get_around_method_modifiers',
701 # 'exists' => 'has_around_method_modifiers',
702 # # This actually makes sure there is an
703 # # ARRAY at the given key, and pushed onto
704 # # it. It also checks for duplicates as well
705 # # 'add' => 'add_around_method_modifier'
709 # # override is similar to the other modifiers
710 # # except that it is not an ARRAY of code refs
711 # # but instead just a single name->code mapping
713 # has 'override_method_modifiers' => (
714 # metaclass => 'Hash',
715 # reader =>'get_override_method_modifiers_map',
716 # isa => 'HashRef[CodeRef]',
718 # 'keys' => 'get_override_method_modifier',
719 # 'exists' => 'has_override_method_modifier',
720 # 'add' => 'add_override_method_modifier', # checks for local method ..
724 #####################################################################
729 # ABSTRACT: The Moose Role metaclass
737 This class is a subclass of L<Class::MOP::Module> that provides
738 additional Moose-specific functionality.
740 Its API looks a lot like L<Moose::Meta::Class>, but internally it
741 implements many things differently. This may change in the future.
745 C<Moose::Meta::Role> is a subclass of L<Class::MOP::Module>.
753 =item B<< Moose::Meta::Role->initialize($role_name) >>
755 This method creates a new role object with the provided name.
757 =item B<< Moose::Meta::Role->combine( [ $role => { ... } ], [ $role ], ... ) >>
759 This method accepts a list of array references. Each array reference
760 should contain a role name or L<Moose::Meta::Role> object as its first element. The second element is
761 an optional hash reference. The hash reference can contain C<-excludes>
762 and C<-alias> keys to control how methods are composed from the role.
764 The return value is a new L<Moose::Meta::Role::Composite> that
765 represents the combined roles.
767 =item B<< $metarole->composition_class_roles >>
769 When combining multiple roles using C<combine>, this method is used to obtain a
770 list of role names to be applied to the L<Moose::Meta::Role::Composite>
771 instance returned by C<combine>. The default implementation returns an empty
772 list. Extensions that need to hook into role combination may wrap this method
773 to return additional role names.
775 =item B<< Moose::Meta::Role->create($name, %options) >>
777 This method is identical to the L<Moose::Meta::Class> C<create>
780 =item B<< Moose::Meta::Role->create_anon_role >>
782 This method is identical to the L<Moose::Meta::Class>
783 C<create_anon_class> method.
785 =item B<< $metarole->is_anon_role >>
787 Returns true if the role is an anonymous role.
789 =item B<< $metarole->consumers >>
791 Returns a list of names of classes and roles which consume this role.
795 =head2 Role application
799 =item B<< $metarole->apply( $thing, @options ) >>
801 This method applies a role to the given C<$thing>. That can be another
802 L<Moose::Meta::Role>, object, a L<Moose::Meta::Class> object, or a
803 (non-meta) object instance.
805 The options are passed directly to the constructor for the appropriate
806 L<Moose::Meta::Role::Application> subclass.
808 Note that this will apply the role even if the C<$thing> in question already
809 C<does> this role. L<Moose::Util/does_role> is a convenient wrapper for
810 finding out if role application is necessary.
814 =head2 Roles and other roles
818 =item B<< $metarole->get_roles >>
820 This returns an array reference of roles which this role does. This
821 list may include duplicates.
823 =item B<< $metarole->calculate_all_roles >>
825 This returns a I<unique> list of all roles that this role does, and
826 all the roles that its roles do.
828 =item B<< $metarole->does_role($role) >>
830 Given a role I<name> or L<Moose::Meta::Role> object, returns true if this role
833 =item B<< $metarole->add_role($role) >>
835 Given a L<Moose::Meta::Role> object, this adds the role to the list of
836 roles that the role does.
838 =item B<< $metarole->get_excluded_roles_list >>
840 Returns a list of role names which this role excludes.
842 =item B<< $metarole->excludes_role($role_name) >>
844 Given a role I<name>, returns true if this role excludes the named
847 =item B<< $metarole->add_excluded_roles(@role_names) >>
849 Given one or more role names, adds those roles to the list of excluded
856 The methods for dealing with a role's methods are all identical in API
857 and behavior to the same methods in L<Class::MOP::Class>.
861 =item B<< $metarole->method_metaclass >>
863 Returns the method metaclass name for the role. This defaults to
864 L<Moose::Meta::Role::Method>.
866 =item B<< $metarole->get_method($name) >>
868 =item B<< $metarole->has_method($name) >>
870 =item B<< $metarole->add_method( $name, $body ) >>
872 =item B<< $metarole->get_method_list >>
874 =item B<< $metarole->find_method_by_name($name) >>
876 These methods are all identical to the methods of the same name in
877 L<Class::MOP::Package>
883 As with methods, the methods for dealing with a role's attribute are
884 all identical in API and behavior to the same methods in
885 L<Class::MOP::Class>.
887 However, attributes stored in this class are I<not> stored as
888 objects. Rather, the attribute definition is stored as a hash
889 reference. When a role is composed into a class, this hash reference
890 is passed directly to the metaclass's C<add_attribute> method.
892 This is quite likely to change in the future.
896 =item B<< $metarole->get_attribute($attribute_name) >>
898 =item B<< $metarole->has_attribute($attribute_name) >>
900 =item B<< $metarole->get_attribute_list >>
902 =item B<< $metarole->add_attribute($name, %options) >>
904 =item B<< $metarole->remove_attribute($attribute_name) >>
908 =head2 Required methods
912 =item B<< $metarole->get_required_method_list >>
914 Returns the list of methods required by the role.
916 =item B<< $metarole->requires_method($name) >>
918 Returns true if the role requires the named method.
920 =item B<< $metarole->add_required_methods(@names) >>
922 Adds the named methods to the role's list of required methods.
924 =item B<< $metarole->remove_required_methods(@names) >>
926 Removes the named methods from the role's list of required methods.
928 =item B<< $metarole->add_conflicting_method(%params) >>
930 Instantiate the parameters as a L<Moose::Meta::Role::Method::Conflicting>
931 object, then add it to the required method list.
935 =head2 Method modifiers
937 These methods act like their counterparts in L<Class::MOP::Class> and
938 L<Moose::Meta::Class>.
940 However, method modifiers are simply stored internally, and are not
941 applied until the role itself is applied to a class.
945 =item B<< $metarole->add_after_method_modifier($method_name, $method) >>
947 =item B<< $metarole->add_around_method_modifier($method_name, $method) >>
949 =item B<< $metarole->add_before_method_modifier($method_name, $method) >>
951 =item B<< $metarole->add_override_method_modifier($method_name, $method) >>
953 These methods all add an appropriate modifier to the internal list of
956 =item B<< $metarole->has_after_method_modifiers >>
958 =item B<< $metarole->has_around_method_modifiers >>
960 =item B<< $metarole->has_before_method_modifiers >>
962 =item B<< $metarole->has_override_method_modifier >>
964 Return true if the role has any modifiers of the given type.
966 =item B<< $metarole->get_after_method_modifiers($method_name) >>
968 =item B<< $metarole->get_around_method_modifiers($method_name) >>
970 =item B<< $metarole->get_before_method_modifiers($method_name) >>
972 Given a method name, returns a list of the appropriate modifiers for
975 =item B<< $metarole->get_override_method_modifier($method_name) >>
977 Given a method name, returns the override method modifier for that
978 method, if it has one.
986 =item B<< Moose::Meta::Role->meta >>
988 This will return a L<Class::MOP::Class> instance for this class.
994 See L<Moose/BUGS> for details on reporting bugs.