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,
85 default => sub { {} },
86 Class::MOP::_definition_context(),
89 # create some helper methods
90 $META->add_method($methods->{add} => sub {
91 my ($self, @values) = @_;
92 $self->$attr_reader->{$_} = undef foreach @values;
93 }) if exists $methods->{add};
95 $META->add_method($methods->{get_keys} => sub {
97 keys %{$self->$attr_reader};
98 }) if exists $methods->{get_keys};
100 $META->add_method($methods->{get_values} => sub {
102 values %{$self->$attr_reader};
103 }) if exists $methods->{get_values};
105 $META->add_method($methods->{get} => sub {
106 my ($self, $name) = @_;
107 $self->$attr_reader->{$name}
108 }) if exists $methods->{get};
110 $META->add_method($methods->{existence} => sub {
111 my ($self, $name) = @_;
112 exists $self->$attr_reader->{$name} ? 1 : 0;
113 }) if exists $methods->{existence};
115 $META->add_method($methods->{remove} => sub {
116 my ($self, @values) = @_;
117 delete $self->$attr_reader->{$_} foreach @values;
118 }) if exists $methods->{remove};
121 $META->add_attribute(
123 reader => 'method_metaclass',
124 default => 'Moose::Meta::Role::Method',
125 Class::MOP::_definition_context(),
128 $META->add_attribute(
129 'required_method_metaclass',
130 reader => 'required_method_metaclass',
131 default => 'Moose::Meta::Role::Method::Required',
132 Class::MOP::_definition_context(),
135 $META->add_attribute(
136 'conflicting_method_metaclass',
137 reader => 'conflicting_method_metaclass',
138 default => 'Moose::Meta::Role::Method::Conflicting',
139 Class::MOP::_definition_context(),
142 $META->add_attribute(
143 'application_to_class_class',
144 reader => 'application_to_class_class',
145 default => 'Moose::Meta::Role::Application::ToClass',
146 Class::MOP::_definition_context(),
149 $META->add_attribute(
150 'application_to_role_class',
151 reader => 'application_to_role_class',
152 default => 'Moose::Meta::Role::Application::ToRole',
153 Class::MOP::_definition_context(),
156 $META->add_attribute(
157 'application_to_instance_class',
158 reader => 'application_to_instance_class',
159 default => 'Moose::Meta::Role::Application::ToInstance',
160 Class::MOP::_definition_context(),
163 $META->add_attribute(
164 'applied_attribute_metaclass',
165 reader => 'applied_attribute_metaclass',
166 default => 'Moose::Meta::Attribute',
167 Class::MOP::_definition_context(),
170 # More or less copied from Moose::Meta::Class
174 unshift @args, 'package' if @args % 2;
176 my $package = delete $opts{package};
177 return Class::MOP::get_metaclass_by_name($package)
178 || $class->SUPER::initialize($package,
179 'attribute_metaclass' => 'Moose::Meta::Role::Attribute',
188 my $meta = blessed $pkg ? $pkg : Class::MOP::class_of($pkg);
190 my %existing_classes;
192 %existing_classes = map { $_ => $meta->$_() } qw(
195 wrapped_method_metaclass
196 required_method_metaclass
197 conflicting_method_metaclass
198 application_to_class_class
199 application_to_role_class
200 application_to_instance_class
201 applied_attribute_metaclass
206 $options{weaken} = Class::MOP::metaclass_is_weak($meta->name)
207 if !exists $options{weaken}
209 && $meta->isa('Moose::Meta::Role');
211 # don't need to remove generated metaobjects here yet, since we don't
212 # yet generate anything in roles. this may change in the future though...
213 # keep an eye on that
214 my $new_meta = $self->SUPER::reinitialize(
219 $new_meta->_restore_metaobjects_from($meta)
220 if $meta && $meta->isa('Moose::Meta::Role');
224 sub _restore_metaobjects_from {
228 $self->_restore_metamethods_from($old_meta);
229 $self->_restore_metaattributes_from($old_meta);
231 for my $role ( @{ $old_meta->get_roles } ) {
232 $self->add_role($role);
239 if (blessed $_[0] && ! $_[0]->isa('Moose::Meta::Role::Attribute') ) {
240 my $class = ref $_[0];
241 Moose->throw_error( "Cannot add a $class as an attribute to a role" );
243 elsif (!blessed($_[0]) && defined($_[0]) && $_[0] =~ /^\+(.*)/) {
244 Moose->throw_error( "has '+attr' is not supported in roles" );
247 return $self->SUPER::add_attribute(@_);
250 sub _attach_attribute {
251 my ( $self, $attribute ) = @_;
253 $attribute->attach_to_role($self);
256 sub add_required_methods {
261 if (!blessed($method)) {
262 $method = $self->required_method_metaclass->new(
266 $self->get_required_methods_map->{$method->name} = $method;
270 sub add_conflicting_method {
274 if (@_ == 1 && blessed($_[0])) {
278 $method = $self->conflicting_method_metaclass->new(@_);
281 $self->add_required_methods($method);
284 ## ------------------------------------------------------------------
288 # the before/around/after method modifiers are
289 # stored by name, but there can be many methods
290 # then associated with that name. So again we have
291 # lots of similar functionality, so we can do some
292 # meta-programmin' and save some time.
295 foreach my $modifier_type (qw[ before around after ]) {
297 my $attr_reader = "get_${modifier_type}_method_modifiers_map";
299 # create the attribute ...
300 $META->add_attribute("${modifier_type}_method_modifiers" => (
301 reader => $attr_reader,
302 default => sub { {} },
303 Class::MOP::_definition_context(),
306 # and some helper methods ...
307 $META->add_method("get_${modifier_type}_method_modifiers" => sub {
308 my ($self, $method_name) = @_;
309 #return () unless exists $self->$attr_reader->{$method_name};
310 my $mm = $self->$attr_reader->{$method_name};
314 $META->add_method("has_${modifier_type}_method_modifiers" => sub {
315 my ($self, $method_name) = @_;
317 # for now we assume that if it exists,..
318 # it has at least one modifier in it
319 (exists $self->$attr_reader->{$method_name}) ? 1 : 0;
322 $META->add_method("add_${modifier_type}_method_modifier" => sub {
323 my ($self, $method_name, $method) = @_;
325 $self->$attr_reader->{$method_name} = []
326 unless exists $self->$attr_reader->{$method_name};
328 my $modifiers = $self->$attr_reader->{$method_name};
331 # check to see that we aren't adding the
332 # same code twice. We err in favor of the
333 # first on here, this may not be as expected
334 foreach my $modifier (@{$modifiers}) {
335 return if $modifier == $method;
338 push @{$modifiers} => $method;
343 ## ------------------------------------------------------------------
344 ## override method mofidiers
346 $META->add_attribute('override_method_modifiers' => (
347 reader => 'get_override_method_modifiers_map',
348 default => sub { {} },
349 Class::MOP::_definition_context(),
353 # these are a little different because there
354 # can only be one per name, whereas the other
355 # method modifiers can have multiples.
358 sub add_override_method_modifier {
359 my ($self, $method_name, $method) = @_;
360 (!$self->has_method($method_name))
361 || Moose->throw_error("Cannot add an override of method '$method_name' " .
362 "because there is a local version of '$method_name'");
363 $self->get_override_method_modifiers_map->{$method_name} = $method;
366 sub has_override_method_modifier {
367 my ($self, $method_name) = @_;
369 # for now we assume that if it exists,..
370 # it has at least one modifier in it
371 (exists $self->get_override_method_modifiers_map->{$method_name}) ? 1 : 0;
374 sub get_override_method_modifier {
375 my ($self, $method_name) = @_;
376 $self->get_override_method_modifiers_map->{$method_name};
379 ## general list accessor ...
381 sub get_method_modifier_list {
382 my ($self, $modifier_type) = @_;
383 my $accessor = "get_${modifier_type}_method_modifiers_map";
384 keys %{$self->$accessor};
387 sub _meta_method_class { 'Moose::Meta::Method::Meta' }
389 ## ------------------------------------------------------------------
392 $META->add_attribute('roles' => (
393 reader => 'get_roles',
394 default => sub { [] },
395 Class::MOP::_definition_context(),
399 my ($self, $role) = @_;
400 (blessed($role) && $role->isa('Moose::Meta::Role'))
401 || Moose->throw_error("Roles must be instances of Moose::Meta::Role");
402 push @{$self->get_roles} => $role;
403 $self->reset_package_cache_flag;
406 sub calculate_all_roles {
412 $_->calculate_all_roles
413 } @{ $self->get_roles });
417 my ($self, $role) = @_;
419 || Moose->throw_error("You must supply a role name to look for");
420 my $role_name = blessed $role ? $role->name : $role;
421 # if we are it,.. then return true
422 return 1 if $role_name eq $self->name;
423 # otherwise.. check our children
424 foreach my $role (@{$self->get_roles}) {
425 return 1 if $role->does_role($role_name);
430 sub find_method_by_name { (shift)->get_method(@_) }
432 ## ------------------------------------------------------------------
434 ## ------------------------------------------------------------------
437 my ($self, $other, %args) = @_;
440 || Moose->throw_error("You must pass in an blessed instance");
442 my $application_class;
443 if ($other->isa('Moose::Meta::Role')) {
444 $application_class = $self->application_to_role_class;
446 elsif ($other->isa('Moose::Meta::Class')) {
447 $application_class = $self->application_to_class_class;
450 $application_class = $self->application_to_instance_class;
453 Class::MOP::load_class($application_class);
455 if ( exists $args{'-excludes'} ) {
456 # I wish we had coercion here :)
457 $args{'-excludes'} = (
458 ref $args{'-excludes'} eq 'ARRAY'
460 : [ $args{'-excludes'} ]
464 return $application_class->new(%args)->apply($self, $other, \%args);
467 sub composition_class_roles { }
470 my ($class, @role_specs) = @_;
472 require Moose::Meta::Role::Composite;
474 my (@roles, %role_params);
475 while (@role_specs) {
476 my ($role, $params) = @{ splice @role_specs, 0, 1 };
480 : Class::MOP::class_of($role);
482 my $actual_role = $requested_role->_role_for_combination($params);
483 push @roles => $actual_role;
485 next unless defined $params;
486 $role_params{$actual_role->name} = $params;
489 my $c = Moose::Meta::Role::Composite->new(roles => \@roles);
490 return $c->apply_params(\%role_params);
493 sub _role_for_combination {
494 my ($self, $params) = @_;
502 unshift @args, 'package' if @args % 2 == 1;
505 (ref $options{attributes} eq 'HASH')
506 || confess "You must pass a HASH ref of attributes"
507 if exists $options{attributes};
509 (ref $options{methods} eq 'HASH')
510 || confess "You must pass a HASH ref of methods"
511 if exists $options{methods};
513 (ref $options{roles} eq 'ARRAY')
514 || confess "You must pass an ARRAY ref of roles"
515 if exists $options{roles};
517 my $package = delete $options{package};
518 my $roles = delete $options{roles};
519 my $attributes = delete $options{attributes};
520 my $methods = delete $options{methods};
521 my $meta_name = exists $options{meta_name}
522 ? delete $options{meta_name}
525 my $meta = $class->SUPER::create($package => %options);
527 $meta->_add_meta_method($meta_name)
528 if defined $meta_name;
530 if (defined $attributes) {
531 foreach my $attribute_name (keys %{$attributes}) {
532 my $attr = $attributes->{$attribute_name};
533 $meta->add_attribute(
534 $attribute_name => blessed $attr ? $attr : %{$attr} );
538 if (defined $methods) {
539 foreach my $method_name (keys %{$methods}) {
540 $meta->add_method($method_name, $methods->{$method_name});
545 Moose::Util::apply_all_roles($meta, @$roles);
554 for my $meta (Class::MOP::get_all_metaclass_instances) {
555 next if $meta->name eq $self->name;
556 next unless $meta->isa('Moose::Meta::Class')
557 || $meta->isa('Moose::Meta::Role');
558 push @consumers, $meta->name
559 if $meta->does_role($self->name);
564 # XXX: something more intelligent here?
565 sub _anon_package_prefix { 'Moose::Meta::Role::__ANON__::SERIAL::' }
567 sub create_anon_role { shift->create_anon(@_) }
568 sub is_anon_role { shift->is_anon(@_) }
570 sub _anon_cache_key {
574 # XXX fix this duplication (see MMC::_anon_cache_key
575 my $roles = Data::OptList::mkopt(($options{roles} || []), {
577 val_test => sub { ref($_[0]) eq 'HASH' },
581 for my $role_spec (@$roles) {
582 my ($role, $params) = @$role_spec;
583 $params = { %$params };
585 my $key = blessed($role) ? $role->name : $role;
587 if ($params && %$params) {
588 my $alias = delete $params->{'-alias'}
589 || delete $params->{'alias'}
591 my $excludes = delete $params->{'-excludes'}
592 || delete $params->{'excludes'}
594 $excludes = [$excludes] unless ref($excludes) eq 'ARRAY';
597 warn "Roles with parameters cannot be cached. Consider "
598 . "applying the parameters before calling "
599 . "create_anon_class, or using 'weaken => 0' instead";
603 my $alias_key = join('%',
604 map { $_ => $alias->{$_} } sort keys %$alias
606 my $excludes_key = join('%',
609 $key .= '<' . join('+', 'a', $alias_key, 'e', $excludes_key) . '>';
612 push @role_keys, $key;
615 # Makes something like Role|Role::1
616 return join('|', sort @role_keys);
619 #####################################################################
621 ## This is Moose::Meta::Role as defined by Moose (plus the use of
622 ## MooseX::AttributeHelpers module). It is here as a reference to
623 ## make it easier to see what is happening above with all the meta
625 #####################################################################
628 # metaclass => 'Array',
629 # reader => 'get_roles',
630 # isa => 'ArrayRef[Moose::Meta::Role]',
631 # default => sub { [] },
633 # 'push' => 'add_role',
637 # has 'excluded_roles_map' => (
638 # metaclass => 'Hash',
639 # reader => 'get_excluded_roles_map',
640 # isa => 'HashRef[Str]',
642 # # Not exactly set, cause it sets multiple
643 # 'set' => 'add_excluded_roles',
644 # 'keys' => 'get_excluded_roles_list',
645 # 'exists' => 'excludes_role',
649 # has 'required_methods' => (
650 # metaclass => 'Hash',
651 # reader => 'get_required_methods_map',
652 # isa => 'HashRef[Moose::Meta::Role::Method::Required]',
654 # # not exactly set, or delete since it works for multiple
655 # 'set' => 'add_required_methods',
656 # 'delete' => 'remove_required_methods',
657 # 'keys' => 'get_required_method_list',
658 # 'exists' => 'requires_method',
662 # # the before, around and after modifiers are
663 # # HASH keyed by method-name, with ARRAY of
664 # # CODE refs to apply in that order
666 # has 'before_method_modifiers' => (
667 # metaclass => 'Hash',
668 # reader => 'get_before_method_modifiers_map',
669 # isa => 'HashRef[ArrayRef[CodeRef]]',
671 # 'keys' => 'get_before_method_modifiers',
672 # 'exists' => 'has_before_method_modifiers',
673 # # This actually makes sure there is an
674 # # ARRAY at the given key, and pushed onto
675 # # it. It also checks for duplicates as well
676 # # 'add' => 'add_before_method_modifier'
680 # has 'after_method_modifiers' => (
681 # metaclass => 'Hash',
682 # reader =>'get_after_method_modifiers_map',
683 # isa => 'HashRef[ArrayRef[CodeRef]]',
685 # 'keys' => 'get_after_method_modifiers',
686 # 'exists' => 'has_after_method_modifiers',
687 # # This actually makes sure there is an
688 # # ARRAY at the given key, and pushed onto
689 # # it. It also checks for duplicates as well
690 # # 'add' => 'add_after_method_modifier'
694 # has 'around_method_modifiers' => (
695 # metaclass => 'Hash',
696 # reader =>'get_around_method_modifiers_map',
697 # isa => 'HashRef[ArrayRef[CodeRef]]',
699 # 'keys' => 'get_around_method_modifiers',
700 # 'exists' => 'has_around_method_modifiers',
701 # # This actually makes sure there is an
702 # # ARRAY at the given key, and pushed onto
703 # # it. It also checks for duplicates as well
704 # # 'add' => 'add_around_method_modifier'
708 # # override is similar to the other modifiers
709 # # except that it is not an ARRAY of code refs
710 # # but instead just a single name->code mapping
712 # has 'override_method_modifiers' => (
713 # metaclass => 'Hash',
714 # reader =>'get_override_method_modifiers_map',
715 # isa => 'HashRef[CodeRef]',
717 # 'keys' => 'get_override_method_modifier',
718 # 'exists' => 'has_override_method_modifier',
719 # 'add' => 'add_override_method_modifier', # checks for local method ..
723 #####################################################################
728 # ABSTRACT: The Moose Role metaclass
736 This class is a subclass of L<Class::MOP::Module> that provides
737 additional Moose-specific functionality.
739 Its API looks a lot like L<Moose::Meta::Class>, but internally it
740 implements many things differently. This may change in the future.
744 C<Moose::Meta::Role> is a subclass of L<Class::MOP::Module>.
752 =item B<< Moose::Meta::Role->initialize($role_name) >>
754 This method creates a new role object with the provided name.
756 =item B<< Moose::Meta::Role->combine( [ $role => { ... } ], [ $role ], ... ) >>
758 This method accepts a list of array references. Each array reference
759 should contain a role name or L<Moose::Meta::Role> object as its first element. The second element is
760 an optional hash reference. The hash reference can contain C<-excludes>
761 and C<-alias> keys to control how methods are composed from the role.
763 The return value is a new L<Moose::Meta::Role::Composite> that
764 represents the combined roles.
766 =item B<< $metarole->composition_class_roles >>
768 When combining multiple roles using C<combine>, this method is used to obtain a
769 list of role names to be applied to the L<Moose::Meta::Role::Composite>
770 instance returned by C<combine>. The default implementation returns an empty
771 list. Extensions that need to hook into role combination may wrap this method
772 to return additional role names.
774 =item B<< Moose::Meta::Role->create($name, %options) >>
776 This method is identical to the L<Moose::Meta::Class> C<create>
779 =item B<< Moose::Meta::Role->create_anon_role >>
781 This method is identical to the L<Moose::Meta::Class>
782 C<create_anon_class> method.
784 =item B<< $metarole->is_anon_role >>
786 Returns true if the role is an anonymous role.
788 =item B<< $metarole->consumers >>
790 Returns a list of names of classes and roles which consume this role.
794 =head2 Role application
798 =item B<< $metarole->apply( $thing, @options ) >>
800 This method applies a role to the given C<$thing>. That can be another
801 L<Moose::Meta::Role>, object, a L<Moose::Meta::Class> object, or a
802 (non-meta) object instance.
804 The options are passed directly to the constructor for the appropriate
805 L<Moose::Meta::Role::Application> subclass.
807 Note that this will apply the role even if the C<$thing> in question already
808 C<does> this role. L<Moose::Util/does_role> is a convenient wrapper for
809 finding out if role application is necessary.
813 =head2 Roles and other roles
817 =item B<< $metarole->get_roles >>
819 This returns an array reference of roles which this role does. This
820 list may include duplicates.
822 =item B<< $metarole->calculate_all_roles >>
824 This returns a I<unique> list of all roles that this role does, and
825 all the roles that its roles do.
827 =item B<< $metarole->does_role($role) >>
829 Given a role I<name> or L<Moose::Meta::Role> object, returns true if this role
832 =item B<< $metarole->add_role($role) >>
834 Given a L<Moose::Meta::Role> object, this adds the role to the list of
835 roles that the role does.
837 =item B<< $metarole->get_excluded_roles_list >>
839 Returns a list of role names which this role excludes.
841 =item B<< $metarole->excludes_role($role_name) >>
843 Given a role I<name>, returns true if this role excludes the named
846 =item B<< $metarole->add_excluded_roles(@role_names) >>
848 Given one or more role names, adds those roles to the list of excluded
855 The methods for dealing with a role's methods are all identical in API
856 and behavior to the same methods in L<Class::MOP::Class>.
860 =item B<< $metarole->method_metaclass >>
862 Returns the method metaclass name for the role. This defaults to
863 L<Moose::Meta::Role::Method>.
865 =item B<< $metarole->get_method($name) >>
867 =item B<< $metarole->has_method($name) >>
869 =item B<< $metarole->add_method( $name, $body ) >>
871 =item B<< $metarole->get_method_list >>
873 =item B<< $metarole->find_method_by_name($name) >>
875 These methods are all identical to the methods of the same name in
876 L<Class::MOP::Package>
882 As with methods, the methods for dealing with a role's attribute are
883 all identical in API and behavior to the same methods in
884 L<Class::MOP::Class>.
886 However, attributes stored in this class are I<not> stored as
887 objects. Rather, the attribute definition is stored as a hash
888 reference. When a role is composed into a class, this hash reference
889 is passed directly to the metaclass's C<add_attribute> method.
891 This is quite likely to change in the future.
895 =item B<< $metarole->get_attribute($attribute_name) >>
897 =item B<< $metarole->has_attribute($attribute_name) >>
899 =item B<< $metarole->get_attribute_list >>
901 =item B<< $metarole->add_attribute($name, %options) >>
903 =item B<< $metarole->remove_attribute($attribute_name) >>
907 =head2 Required methods
911 =item B<< $metarole->get_required_method_list >>
913 Returns the list of methods required by the role.
915 =item B<< $metarole->requires_method($name) >>
917 Returns true if the role requires the named method.
919 =item B<< $metarole->add_required_methods(@names) >>
921 Adds the named methods to the role's list of required methods.
923 =item B<< $metarole->remove_required_methods(@names) >>
925 Removes the named methods from the role's list of required methods.
927 =item B<< $metarole->add_conflicting_method(%params) >>
929 Instantiate the parameters as a L<Moose::Meta::Role::Method::Conflicting>
930 object, then add it to the required method list.
934 =head2 Method modifiers
936 These methods act like their counterparts in L<Class::MOP::Class> and
937 L<Moose::Meta::Class>.
939 However, method modifiers are simply stored internally, and are not
940 applied until the role itself is applied to a class.
944 =item B<< $metarole->add_after_method_modifier($method_name, $method) >>
946 =item B<< $metarole->add_around_method_modifier($method_name, $method) >>
948 =item B<< $metarole->add_before_method_modifier($method_name, $method) >>
950 =item B<< $metarole->add_override_method_modifier($method_name, $method) >>
952 These methods all add an appropriate modifier to the internal list of
955 =item B<< $metarole->has_after_method_modifiers >>
957 =item B<< $metarole->has_around_method_modifiers >>
959 =item B<< $metarole->has_before_method_modifiers >>
961 =item B<< $metarole->has_override_method_modifier >>
963 Return true if the role has any modifiers of the given type.
965 =item B<< $metarole->get_after_method_modifiers($method_name) >>
967 =item B<< $metarole->get_around_method_modifiers($method_name) >>
969 =item B<< $metarole->get_before_method_modifiers($method_name) >>
971 Given a method name, returns a list of the appropriate modifiers for
974 =item B<< $metarole->get_override_method_modifier($method_name) >>
976 Given a method name, returns the override method modifier for that
977 method, if it has one.
985 =item B<< Moose::Meta::Role->meta >>
987 This will return a L<Class::MOP::Class> instance for this class.
993 See L<Moose/BUGS> for details on reporting bugs.