2 package Moose::Meta::Role;
8 use Scalar::Util 'blessed';
10 use Sub::Name 'subname';
11 use Devel::GlobalDestruction 'in_global_destruction';
13 our $VERSION = '0.79';
14 $VERSION = eval $VERSION;
15 our $AUTHORITY = 'cpan:STEVAN';
17 use Moose::Meta::Class;
18 use Moose::Meta::Role::Method;
19 use Moose::Meta::Role::Method::Required;
21 use base 'Class::MOP::Module';
23 ## ------------------------------------------------------------------
25 ## I normally don't do this, but I am doing
26 ## a whole bunch of meta-programmin in this
27 ## module, so it just makes sense. For a clearer
28 ## picture of what is going on in the next
29 ## several lines of code, look at the really
30 ## big comment at the end of this file (right
33 ## ------------------------------------------------------------------
35 my $META = __PACKAGE__->meta;
37 ## ------------------------------------------------------------------
41 # since roles are lazy, we hold all the attributes
42 # of the individual role in 'statis' until which
43 # time when it is applied to a class. This means
44 # keeping a lot of things in hash maps, so we are
45 # using a little of that meta-programmin' magic
46 # here an saving lots of extra typin. And since
47 # many of these attributes above require similar
48 # functionality to support them, so we again use
49 # the wonders of meta-programmin' to deliver a
50 # very compact solution to this normally verbose
56 name => 'excluded_roles_map',
57 attr_reader => 'get_excluded_roles_map' ,
59 add => 'add_excluded_roles',
60 get_keys => 'get_excluded_roles_list',
61 existence => 'excludes_role',
65 name => 'required_methods',
66 attr_reader => 'get_required_methods_map',
68 remove => 'remove_required_methods',
69 get_values => 'get_required_method_list',
70 existence => 'requires_method',
74 name => 'attribute_map',
75 attr_reader => 'get_attribute_map',
77 get => 'get_attribute',
78 get_keys => 'get_attribute_list',
79 existence => 'has_attribute',
80 remove => 'remove_attribute',
85 my $attr_reader = $action->{attr_reader};
86 my $methods = $action->{methods};
88 # create the attribute
89 $META->add_attribute($action->{name} => (
90 reader => $attr_reader,
94 # create some helper methods
95 $META->add_method($methods->{add} => sub {
96 my ($self, @values) = @_;
97 $self->$attr_reader->{$_} = undef foreach @values;
98 }) if exists $methods->{add};
100 $META->add_method($methods->{get_keys} => sub {
102 keys %{$self->$attr_reader};
103 }) if exists $methods->{get_keys};
105 $META->add_method($methods->{get_values} => sub {
107 values %{$self->$attr_reader};
108 }) if exists $methods->{get_values};
110 $META->add_method($methods->{get} => sub {
111 my ($self, $name) = @_;
112 $self->$attr_reader->{$name}
113 }) if exists $methods->{get};
115 $META->add_method($methods->{existence} => sub {
116 my ($self, $name) = @_;
117 exists $self->$attr_reader->{$name} ? 1 : 0;
118 }) if exists $methods->{existence};
120 $META->add_method($methods->{remove} => sub {
121 my ($self, @values) = @_;
122 delete $self->$attr_reader->{$_} foreach @values;
123 }) if exists $methods->{remove};
126 $META->add_attribute(
128 reader => 'method_metaclass',
129 default => 'Moose::Meta::Role::Method',
132 $META->add_attribute(
133 'required_method_metaclass',
134 reader => 'required_method_metaclass',
135 default => 'Moose::Meta::Role::Method::Required',
138 ## some things don't always fit, so they go here ...
143 unless ( defined $name && $name ) {
145 Moose->throw_error("You must provide a name for the attribute");
148 if (scalar @_ == 1 && ref($_[0]) eq 'HASH') {
154 $self->get_attribute_map->{$name} = $attr_desc;
157 sub add_required_methods {
162 if (!blessed($method)) {
163 $method = $self->required_method_metaclass->new(
167 $self->get_required_methods_map->{$method->name} = $method;
171 ## ------------------------------------------------------------------
175 # the before/around/after method modifiers are
176 # stored by name, but there can be many methods
177 # then associated with that name. So again we have
178 # lots of similar functionality, so we can do some
179 # meta-programmin' and save some time.
182 foreach my $modifier_type (qw[ before around after ]) {
184 my $attr_reader = "get_${modifier_type}_method_modifiers_map";
186 # create the attribute ...
187 $META->add_attribute("${modifier_type}_method_modifiers" => (
188 reader => $attr_reader,
189 default => sub { {} }
192 # and some helper methods ...
193 $META->add_method("get_${modifier_type}_method_modifiers" => sub {
194 my ($self, $method_name) = @_;
195 #return () unless exists $self->$attr_reader->{$method_name};
196 @{$self->$attr_reader->{$method_name}};
199 $META->add_method("has_${modifier_type}_method_modifiers" => sub {
200 my ($self, $method_name) = @_;
202 # for now we assume that if it exists,..
203 # it has at least one modifier in it
204 (exists $self->$attr_reader->{$method_name}) ? 1 : 0;
207 $META->add_method("add_${modifier_type}_method_modifier" => sub {
208 my ($self, $method_name, $method) = @_;
210 $self->$attr_reader->{$method_name} = []
211 unless exists $self->$attr_reader->{$method_name};
213 my $modifiers = $self->$attr_reader->{$method_name};
216 # check to see that we aren't adding the
217 # same code twice. We err in favor of the
218 # first on here, this may not be as expected
219 foreach my $modifier (@{$modifiers}) {
220 return if $modifier == $method;
223 push @{$modifiers} => $method;
228 ## ------------------------------------------------------------------
229 ## override method mofidiers
231 $META->add_attribute('override_method_modifiers' => (
232 reader => 'get_override_method_modifiers_map',
233 default => sub { {} }
237 # these are a little different because there
238 # can only be one per name, whereas the other
239 # method modifiers can have multiples.
242 sub add_override_method_modifier {
243 my ($self, $method_name, $method) = @_;
244 (!$self->has_method($method_name))
245 || Moose->throw_error("Cannot add an override of method '$method_name' " .
246 "because there is a local version of '$method_name'");
247 $self->get_override_method_modifiers_map->{$method_name} = $method;
250 sub has_override_method_modifier {
251 my ($self, $method_name) = @_;
253 # for now we assume that if it exists,..
254 # it has at least one modifier in it
255 (exists $self->get_override_method_modifiers_map->{$method_name}) ? 1 : 0;
258 sub get_override_method_modifier {
259 my ($self, $method_name) = @_;
260 $self->get_override_method_modifiers_map->{$method_name};
263 ## general list accessor ...
265 sub get_method_modifier_list {
266 my ($self, $modifier_type) = @_;
267 my $accessor = "get_${modifier_type}_method_modifiers_map";
268 keys %{$self->$accessor};
271 sub reset_package_cache_flag { (shift)->{'_package_cache_flag'} = undef }
272 sub update_package_cache_flag {
274 $self->{'_package_cache_flag'} = Class::MOP::check_package_cache_flag($self->name);
279 ## ------------------------------------------------------------------
282 $META->add_attribute('roles' => (
283 reader => 'get_roles',
284 default => sub { [] }
288 my ($self, $role) = @_;
289 (blessed($role) && $role->isa('Moose::Meta::Role'))
290 || Moose->throw_error("Roles must be instances of Moose::Meta::Role");
291 push @{$self->get_roles} => $role;
292 $self->reset_package_cache_flag;
295 sub calculate_all_roles {
301 $_->calculate_all_roles
302 } @{ $self->get_roles });
306 my ($self, $role_name) = @_;
308 || Moose->throw_error("You must supply a role name to look for");
309 # if we are it,.. then return true
310 return 1 if $role_name eq $self->name;
311 # otherwise.. check our children
312 foreach my $role (@{$self->get_roles}) {
313 return 1 if $role->does_role($role_name);
318 ## ------------------------------------------------------------------
324 my $current = Class::MOP::check_package_cache_flag($self->name);
326 if (defined $self->{'_package_cache_flag'} && $self->{'_package_cache_flag'} == $current) {
327 return $self->{'methods'} ||= {};
330 $self->{_package_cache_flag} = $current;
332 my $map = $self->{'methods'} ||= {};
334 my $role_name = $self->name;
335 my $method_metaclass = $self->method_metaclass;
337 my $all_code = $self->get_all_package_symbols('CODE');
339 foreach my $symbol (keys %{ $all_code }) {
340 my $code = $all_code->{$symbol};
342 next if exists $map->{$symbol} &&
343 defined $map->{$symbol} &&
344 $map->{$symbol}->body == $code;
346 my ($pkg, $name) = Class::MOP::get_code_info($code);
347 my $meta = Class::MOP::class_of($pkg);
349 if ($meta && $meta->isa('Moose::Meta::Role')) {
350 my $role = $meta->name;
351 next unless $self->does_role($role);
355 # in 5.10 constant.pm the constants show up
356 # as being in the right package, but in pre-5.10
357 # they show up as constant::__ANON__ so we
358 # make an exception here to be sure that things
359 # work as expected in both.
361 unless ($pkg eq 'constant' && $name eq '__ANON__') {
362 next if ($pkg || '') ne $role_name ||
363 (($name || '') ne '__ANON__' && ($pkg || '') ne $role_name);
367 $map->{$symbol} = $method_metaclass->wrap(
369 package_name => $role_name,
378 my ($self, $name) = @_;
379 $self->get_method_map->{$name};
383 my ($self, $name) = @_;
384 exists $self->get_method_map->{$name} ? 1 : 0
387 # FIXME this is copy-pasted from Class::MOP::Class
388 # refactor to inherit from some common base
389 sub wrap_method_body {
390 my ( $self, %args ) = @_;
392 ('CODE' eq ref $args{body})
393 || Moose->throw_error("Your code block must be a CODE reference");
395 $self->method_metaclass->wrap(
396 package_name => $self->name,
402 my ($self, $method_name, $method) = @_;
403 (defined $method_name && $method_name)
404 || Moose->throw_error("You must define a method name");
407 if (blessed($method)) {
408 $body = $method->body;
409 if ($method->package_name ne $self->name) {
410 $method = $method->clone(
411 package_name => $self->name,
413 ) if $method->can('clone');
418 $method = $self->wrap_method_body( body => $body, name => $method_name );
421 $method->attach_to_class($self);
423 $self->get_method_map->{$method_name} = $method;
425 my $full_method_name = ($self->name . '::' . $method_name);
426 $self->add_package_symbol(
427 { sigil => '&', type => 'CODE', name => $method_name },
428 subname($full_method_name => $body)
431 $self->update_package_cache_flag; # still valid, since we just added the method to the map, and if it was invalid before that then get_method_map updated it
434 sub find_method_by_name { (shift)->get_method(@_) }
436 sub get_method_list {
438 grep { !/^meta$/ } keys %{$self->get_method_map};
442 Carp::cluck("The alias_method method is deprecated. Use add_method instead.\n");
446 $self->add_method(@_);
449 ## ------------------------------------------------------------------
451 ## ------------------------------------------------------------------
454 my ($self, $other, @args) = @_;
457 || Moose->throw_error("You must pass in an blessed instance");
459 if ($other->isa('Moose::Meta::Role')) {
460 require Moose::Meta::Role::Application::ToRole;
461 return Moose::Meta::Role::Application::ToRole->new(@args)->apply($self, $other);
463 elsif ($other->isa('Moose::Meta::Class')) {
464 require Moose::Meta::Role::Application::ToClass;
465 return Moose::Meta::Role::Application::ToClass->new(@args)->apply($self, $other);
468 require Moose::Meta::Role::Application::ToInstance;
469 return Moose::Meta::Role::Application::ToInstance->new(@args)->apply($self, $other);
474 my ($class, @role_specs) = @_;
476 require Moose::Meta::Role::Application::RoleSummation;
477 require Moose::Meta::Role::Composite;
479 my (@roles, %role_params);
480 while (@role_specs) {
481 my ($role_name, $params) = @{ splice @role_specs, 0, 1 };
482 my $requested_role = Class::MOP::class_of($role_name);
484 my $actual_role = $requested_role->_role_for_combination($params);
485 push @roles => $actual_role;
487 next unless defined $params;
488 $role_params{$actual_role->name} = $params;
491 my $c = Moose::Meta::Role::Composite->new(roles => \@roles);
492 Moose::Meta::Role::Application::RoleSummation->new(
493 role_params => \%role_params
499 sub _role_for_combination {
500 my ($self, $params) = @_;
505 my ( $role, $package_name, %options ) = @_;
507 $options{package} = $package_name;
509 (ref $options{attributes} eq 'HASH')
510 || confess "You must pass a HASH ref of attributes"
511 if exists $options{attributes};
513 (ref $options{methods} eq 'HASH')
514 || confess "You must pass a HASH ref of methods"
515 if exists $options{methods};
517 my (%initialize_options) = %options;
518 delete @initialize_options{qw(
526 my $meta = $role->initialize( $package_name => %initialize_options );
528 $meta->_instantiate_module( $options{version}, $options{authority} );
531 $meta->add_method('meta' => sub {
532 $role->initialize(ref($_[0]) || $_[0]);
535 if (exists $options{attributes}) {
536 foreach my $attribute_name (keys %{$options{attributes}}) {
537 my $attr = $options{attributes}->{$attribute_name};
538 $meta->add_attribute($attribute_name => $attr);
542 if (exists $options{methods}) {
543 foreach my $method_name (keys %{$options{methods}}) {
544 $meta->add_method($method_name, $options{methods}->{$method_name});
548 Class::MOP::weaken_metaclass($meta->name)
549 if $meta->is_anon_role;
554 # anonymous roles. most of it is copied straight out of Class::MOP::Class.
555 # an intrepid hacker might find great riches if he unifies this code with that
556 # code in Class::MOP::Module or Class::MOP::Package
559 # this should be sufficient, if you have a
560 # use case where it is not, write a test and
562 my $ANON_ROLE_SERIAL = 0;
565 # we need a sufficiently annoying prefix
566 # this should suffice for now, this is
567 # used in a couple of places below, so
568 # need to put it up here for now.
569 my $ANON_ROLE_PREFIX = 'Moose::Meta::Role::__ANON__::SERIAL::';
573 no warnings 'uninitialized';
574 $self->name =~ /^$ANON_ROLE_PREFIX/;
577 sub create_anon_role {
578 my ($role, %options) = @_;
579 my $package_name = $ANON_ROLE_PREFIX . ++$ANON_ROLE_SERIAL;
580 return $role->create($package_name, %options);
584 # this will only get called for
585 # anon-roles, all other calls
586 # are assumed to occur during
587 # global destruction and so don't
588 # really need to be handled explicitly
592 return if in_global_destruction(); # it'll happen soon anyway and this just makes things more complicated
594 no warnings 'uninitialized';
595 return unless $self->name =~ /^$ANON_ROLE_PREFIX/;
597 # XXX: is this necessary for us? I don't understand what it's doing
600 # Moose does a weird thing where it replaces the metaclass for
601 # class when fixing metaclass incompatibility. In that case,
602 # we don't want to clean out the namespace now. We can detect
603 # that because Moose will explicitly update the singleton
604 # cache in Class::MOP.
605 #my $current_meta = Class::MOP::get_metaclass_by_name($self->name);
606 #return if $current_meta ne $self;
608 my ($serial_id) = ($self->name =~ /^$ANON_ROLE_PREFIX(\d+)/);
610 foreach my $key (keys %{$ANON_ROLE_PREFIX . $serial_id}) {
611 delete ${$ANON_ROLE_PREFIX . $serial_id}{$key};
613 delete ${'main::' . $ANON_ROLE_PREFIX}{$serial_id . '::'};
617 #####################################################################
619 ## This is Moose::Meta::Role as defined by Moose (plus the use of
620 ## MooseX::AttributeHelpers module). It is here as a reference to
621 ## make it easier to see what is happening above with all the meta
623 #####################################################################
626 # metaclass => 'Collection::Array',
627 # reader => 'get_roles',
628 # isa => 'ArrayRef[Moose::Meta::Role]',
629 # default => sub { [] },
631 # 'push' => 'add_role',
635 # has 'excluded_roles_map' => (
636 # metaclass => 'Collection::Hash',
637 # reader => 'get_excluded_roles_map',
638 # isa => 'HashRef[Str]',
640 # # Not exactly set, cause it sets multiple
641 # 'set' => 'add_excluded_roles',
642 # 'keys' => 'get_excluded_roles_list',
643 # 'exists' => 'excludes_role',
647 # has 'attribute_map' => (
648 # metaclass => 'Collection::Hash',
649 # reader => 'get_attribute_map',
650 # isa => 'HashRef[Str]',
652 # # 'set' => 'add_attribute' # has some special crap in it
653 # 'get' => 'get_attribute',
654 # 'keys' => 'get_attribute_list',
655 # 'exists' => 'has_attribute',
656 # # Not exactly delete, cause it sets multiple
657 # 'delete' => 'remove_attribute',
661 # has 'required_methods' => (
662 # metaclass => 'Collection::Hash',
663 # reader => 'get_required_methods_map',
664 # isa => 'HashRef[Moose::Meta::Role::Method::Required]',
666 # # not exactly set, or delete since it works for multiple
667 # 'set' => 'add_required_methods',
668 # 'delete' => 'remove_required_methods',
669 # 'keys' => 'get_required_method_list',
670 # 'exists' => 'requires_method',
674 # # the before, around and after modifiers are
675 # # HASH keyed by method-name, with ARRAY of
676 # # CODE refs to apply in that order
678 # has 'before_method_modifiers' => (
679 # metaclass => 'Collection::Hash',
680 # reader => 'get_before_method_modifiers_map',
681 # isa => 'HashRef[ArrayRef[CodeRef]]',
683 # 'keys' => 'get_before_method_modifiers',
684 # 'exists' => 'has_before_method_modifiers',
685 # # This actually makes sure there is an
686 # # ARRAY at the given key, and pushed onto
687 # # it. It also checks for duplicates as well
688 # # 'add' => 'add_before_method_modifier'
692 # has 'after_method_modifiers' => (
693 # metaclass => 'Collection::Hash',
694 # reader =>'get_after_method_modifiers_map',
695 # isa => 'HashRef[ArrayRef[CodeRef]]',
697 # 'keys' => 'get_after_method_modifiers',
698 # 'exists' => 'has_after_method_modifiers',
699 # # This actually makes sure there is an
700 # # ARRAY at the given key, and pushed onto
701 # # it. It also checks for duplicates as well
702 # # 'add' => 'add_after_method_modifier'
706 # has 'around_method_modifiers' => (
707 # metaclass => 'Collection::Hash',
708 # reader =>'get_around_method_modifiers_map',
709 # isa => 'HashRef[ArrayRef[CodeRef]]',
711 # 'keys' => 'get_around_method_modifiers',
712 # 'exists' => 'has_around_method_modifiers',
713 # # This actually makes sure there is an
714 # # ARRAY at the given key, and pushed onto
715 # # it. It also checks for duplicates as well
716 # # 'add' => 'add_around_method_modifier'
720 # # override is similar to the other modifiers
721 # # except that it is not an ARRAY of code refs
722 # # but instead just a single name->code mapping
724 # has 'override_method_modifiers' => (
725 # metaclass => 'Collection::Hash',
726 # reader =>'get_override_method_modifiers_map',
727 # isa => 'HashRef[CodeRef]',
729 # 'keys' => 'get_override_method_modifier',
730 # 'exists' => 'has_override_method_modifier',
731 # 'add' => 'add_override_method_modifier', # checks for local method ..
735 #####################################################################
746 Moose::Meta::Role - The Moose Role metaclass
750 This class is a subclass of L<Class::MOP::Module> that provides
751 additional Moose-specific functionality.
753 It's API looks a lot like L<Moose::Meta::Class>, but internally it
754 implements many things differently. This may change in the future.
758 C<Moose::Meta::Role> is a subclass of L<Class::MOP::Module>.
766 =item B<< Moose::Meta::Role->initialize($role_name) >>
768 This method creates a new role object with the provided name.
770 =item B<< Moose::Meta::Role->combine( [ $role => { ... } ], [ $role ], ... ) >>
772 This method accepts a list of array references. Each array reference
773 should contain a role name as its first element. The second element is
774 an optional hash reference. The hash reference can contain C<exclude>
775 and C<alias> keys to control how methods are composed from the role.
777 The return value is a new L<Moose::Meta::Role::Composite> that
778 represents the combined roles.
780 =item B<< Moose::Meta::Role->create($name, %options) >>
782 This method is identical to the L<Moose::Meta::Class> C<create>
785 =item B<< Moose::Meta::Role->create_anon_role >>
787 This method is identical to the L<Moose::Meta::Class>
788 C<create_anon_class> method.
790 =item B<< $metarole->is_anon_role >>
792 Returns true if the role is an anonymous role.
796 =head2 Role application
800 =item B<< $metarole->apply( $thing, @options ) >>
802 This method applies a role to the given C<$thing>. That can be another
803 L<Moose::Meta::Role>, object, a L<Moose::Meta::Class> object, or a
804 (non-meta) object instance.
806 The options are passed directly to the constructor for the appropriate
807 L<Moose::Meta::Role::Application> subclass.
809 Note that this will apply the role even if the C<$thing> in question already
810 C<does> this role. L<Moose::Util/does_role> is a convenient wrapper for
811 finding out if role application is necessary.
815 =head2 Roles and other roles
819 =item B<< $metarole->get_roles >>
821 This returns an array reference of roles which this role does. This
822 list may include duplicates.
824 =item B<< $metarole->calculate_all_roles >>
826 This returns a I<unique> list of all roles that this role does, and
827 all the roles that its roles do.
829 =item B<< $metarole->does_role($role_name) >>
831 Given a role I<name>, returns true if this role does the given
834 =item B<< $metarole->add_role($role) >>
836 Given a L<Moose::Meta::Role> object, this adds the role to the list of
837 roles that the role does.
839 =item B<< $metarole->get_excluded_roles_list >>
841 Returns a list of role names which this role excludes.
843 =item B<< $metarole->excludes_role($role_name) >>
845 Given a role I<name>, returns true if this role excludes the named
848 =item B<< $metarole->add_excluded_roles(@role_names) >>
850 Given one or more role names, adds those roles to the list of excluded
857 The methods for dealing with a role's methods are all identical in API
858 and behavior to the same methods in L<Class::MOP::Class>.
862 =item B<< $metarole->method_metaclass >>
864 Returns the method metaclass name for the role. This defaults to
865 L<Moose::Meta::Role::Method>.
867 =item B<< $metarole->get_method($name) >>
869 =item B<< $metarole->has_method($name) >>
871 =item B<< $metarole->add_method( $name, $body ) >>
873 =item B<< $metarole->get_method_list >>
875 =item B<< $metarole->get_method_map >>
877 =item B<< $metarole->find_method_by_name($name) >>
879 These methods are all identical to the methods of the same name in
886 As with methods, the methods for dealing with a role's attribute are
887 all identical in API and behavior to the same methods in
888 L<Class::MOP::Class>.
890 However, attributes stored in this class are I<not> stored as
891 objects. Rather, the attribute definition is stored as a hash
892 reference. When a role is composed into a class, this hash reference
893 is passed directly to the metaclass's C<add_attribute> method.
895 This is quite likely to change in the future.
899 =item B<< $metarole->get_attribute($attribute_name) >>
901 =item B<< $metarole->has_attribute($attribute_name) >>
903 =item B<< $metarole->get_attribute_map >>
905 =item B<< $metarole->get_attribute_list >>
907 =item B<< $metarole->add_attribute($name, %options) >>
909 =item B<< $metarole->remove_attribute($attribute_name) >>
913 =head2 Required methods
917 =item B<< $metarole->get_required_method_list >>
919 Returns the list of methods required by the role.
921 =item B<< $metarole->requires_method($name) >>
923 Returns true if the role requires the named method.
925 =item B<< $metarole->add_required_methods(@names) >>
927 Adds the named methods to the role's list of required methods.
929 =item B<< $metarole->remove_required_methods(@names) >>
931 Removes the named methods from the role's list of required methods.
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 All complex software has bugs lurking in it, and this module is no
995 exception. If you find a bug please either email me, or add the bug
1000 Stevan Little E<lt>stevan@iinteractive.comE<gt>
1002 =head1 COPYRIGHT AND LICENSE
1004 Copyright 2006-2009 by Infinity Interactive, Inc.
1006 L<http://www.iinteractive.com>
1008 This library is free software; you can redistribute it and/or modify
1009 it under the same terms as Perl itself.