2 package Moose::Meta::Role;
8 use Scalar::Util 'blessed';
10 use Devel::GlobalDestruction 'in_global_destruction';
12 our $VERSION = '1.19';
13 $VERSION = eval $VERSION;
14 our $AUTHORITY = 'cpan:STEVAN';
16 use Moose::Meta::Class;
17 use Moose::Meta::Role::Attribute;
18 use Moose::Meta::Role::Method;
19 use Moose::Meta::Role::Method::Required;
20 use Moose::Meta::Role::Method::Conflicting;
21 use Moose::Meta::Method::Meta;
22 use Moose::Util qw( ensure_all_roles );
23 use Class::MOP::MiniTrait;
25 use base 'Class::MOP::Module',
26 'Class::MOP::Mixin::HasAttributes',
27 'Class::MOP::Mixin::HasMethods';
29 Class::MOP::MiniTrait::apply(__PACKAGE__, 'Moose::Meta::Object::Trait');
31 ## ------------------------------------------------------------------
33 ## I normally don't do this, but I am doing
34 ## a whole bunch of meta-programmin in this
35 ## module, so it just makes sense. For a clearer
36 ## picture of what is going on in the next
37 ## several lines of code, look at the really
38 ## big comment at the end of this file (right
41 ## ------------------------------------------------------------------
43 my $META = __PACKAGE__->meta;
45 ## ------------------------------------------------------------------
49 # since roles are lazy, we hold all the attributes
50 # of the individual role in 'statis' until which
51 # time when it is applied to a class. This means
52 # keeping a lot of things in hash maps, so we are
53 # using a little of that meta-programmin' magic
54 # here an saving lots of extra typin. And since
55 # many of these attributes above require similar
56 # functionality to support them, so we again use
57 # the wonders of meta-programmin' to deliver a
58 # very compact solution to this normally verbose
64 name => 'excluded_roles_map',
65 attr_reader => 'get_excluded_roles_map' ,
67 add => 'add_excluded_roles',
68 get_keys => 'get_excluded_roles_list',
69 existence => 'excludes_role',
73 name => 'required_methods',
74 attr_reader => 'get_required_methods_map',
76 remove => 'remove_required_methods',
77 get_values => 'get_required_method_list',
78 existence => 'requires_method',
83 my $attr_reader = $action->{attr_reader};
84 my $methods = $action->{methods};
86 # create the attribute
87 $META->add_attribute($action->{name} => (
88 reader => $attr_reader,
92 # create some helper methods
93 $META->add_method($methods->{add} => sub {
94 my ($self, @values) = @_;
95 $self->$attr_reader->{$_} = undef foreach @values;
96 }) if exists $methods->{add};
98 $META->add_method($methods->{get_keys} => sub {
100 keys %{$self->$attr_reader};
101 }) if exists $methods->{get_keys};
103 $META->add_method($methods->{get_values} => sub {
105 values %{$self->$attr_reader};
106 }) if exists $methods->{get_values};
108 $META->add_method($methods->{get} => sub {
109 my ($self, $name) = @_;
110 $self->$attr_reader->{$name}
111 }) if exists $methods->{get};
113 $META->add_method($methods->{existence} => sub {
114 my ($self, $name) = @_;
115 exists $self->$attr_reader->{$name} ? 1 : 0;
116 }) if exists $methods->{existence};
118 $META->add_method($methods->{remove} => sub {
119 my ($self, @values) = @_;
120 delete $self->$attr_reader->{$_} foreach @values;
121 }) if exists $methods->{remove};
124 $META->add_attribute(
126 reader => 'method_metaclass',
127 default => 'Moose::Meta::Role::Method',
130 $META->add_attribute(
131 'required_method_metaclass',
132 reader => 'required_method_metaclass',
133 default => 'Moose::Meta::Role::Method::Required',
136 $META->add_attribute(
137 'conflicting_method_metaclass',
138 reader => 'conflicting_method_metaclass',
139 default => 'Moose::Meta::Role::Method::Conflicting',
142 $META->add_attribute(
143 'application_to_class_class',
144 reader => 'application_to_class_class',
145 default => 'Moose::Meta::Role::Application::ToClass',
148 $META->add_attribute(
149 'application_to_role_class',
150 reader => 'application_to_role_class',
151 default => 'Moose::Meta::Role::Application::ToRole',
154 $META->add_attribute(
155 'application_to_instance_class',
156 reader => 'application_to_instance_class',
157 default => 'Moose::Meta::Role::Application::ToInstance',
160 $META->add_attribute(
161 'applied_attribute_metaclass',
162 reader => 'applied_attribute_metaclass',
163 default => 'Moose::Meta::Attribute',
166 # More or less copied from Moose::Meta::Class
171 if (defined(my $meta = Class::MOP::get_metaclass_by_name($pkg))) {
177 my $meta = $class->SUPER::initialize(
179 'attribute_metaclass' => 'Moose::Meta::Role::Attribute',
183 Class::MOP::weaken_metaclass($pkg) if $options{weaken};
192 my $meta = blessed $pkg ? $pkg : Class::MOP::class_of($pkg);
194 my %existing_classes;
196 %existing_classes = map { $_ => $meta->$_() } qw(
199 wrapped_method_metaclass
200 required_method_metaclass
201 conflicting_method_metaclass
202 application_to_class_class
203 application_to_role_class
204 application_to_instance_class
205 applied_attribute_metaclass
210 $options{weaken} = Class::MOP::metaclass_is_weak($meta->name)
211 if !exists $options{weaken}
213 && $meta->isa('Moose::Meta::Role');
215 # don't need to remove generated metaobjects here yet, since we don't
216 # yet generate anything in roles. this may change in the future though...
217 # keep an eye on that
218 my $new_meta = $self->SUPER::reinitialize(
223 $new_meta->_restore_metaobjects_from($meta)
224 if $meta && $meta->isa('Moose::Meta::Role');
228 sub _restore_metaobjects_from {
232 $self->_restore_metamethods_from($old_meta);
233 $self->_restore_metaattributes_from($old_meta);
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 { {} }
305 # and some helper methods ...
306 $META->add_method("get_${modifier_type}_method_modifiers" => sub {
307 my ($self, $method_name) = @_;
308 #return () unless exists $self->$attr_reader->{$method_name};
309 my $mm = $self->$attr_reader->{$method_name};
313 $META->add_method("has_${modifier_type}_method_modifiers" => sub {
314 my ($self, $method_name) = @_;
316 # for now we assume that if it exists,..
317 # it has at least one modifier in it
318 (exists $self->$attr_reader->{$method_name}) ? 1 : 0;
321 $META->add_method("add_${modifier_type}_method_modifier" => sub {
322 my ($self, $method_name, $method) = @_;
324 $self->$attr_reader->{$method_name} = []
325 unless exists $self->$attr_reader->{$method_name};
327 my $modifiers = $self->$attr_reader->{$method_name};
330 # check to see that we aren't adding the
331 # same code twice. We err in favor of the
332 # first on here, this may not be as expected
333 foreach my $modifier (@{$modifiers}) {
334 return if $modifier == $method;
337 push @{$modifiers} => $method;
342 ## ------------------------------------------------------------------
343 ## override method mofidiers
345 $META->add_attribute('override_method_modifiers' => (
346 reader => 'get_override_method_modifiers_map',
347 default => sub { {} }
351 # these are a little different because there
352 # can only be one per name, whereas the other
353 # method modifiers can have multiples.
356 sub add_override_method_modifier {
357 my ($self, $method_name, $method) = @_;
358 (!$self->has_method($method_name))
359 || Moose->throw_error("Cannot add an override of method '$method_name' " .
360 "because there is a local version of '$method_name'");
361 $self->get_override_method_modifiers_map->{$method_name} = $method;
364 sub has_override_method_modifier {
365 my ($self, $method_name) = @_;
367 # for now we assume that if it exists,..
368 # it has at least one modifier in it
369 (exists $self->get_override_method_modifiers_map->{$method_name}) ? 1 : 0;
372 sub get_override_method_modifier {
373 my ($self, $method_name) = @_;
374 $self->get_override_method_modifiers_map->{$method_name};
377 ## general list accessor ...
379 sub get_method_modifier_list {
380 my ($self, $modifier_type) = @_;
381 my $accessor = "get_${modifier_type}_method_modifiers_map";
382 keys %{$self->$accessor};
385 sub reset_package_cache_flag { (shift)->{'_package_cache_flag'} = undef }
386 sub update_package_cache_flag {
388 $self->{'_package_cache_flag'} = Class::MOP::check_package_cache_flag($self->name);
392 sub _meta_method_class { 'Moose::Meta::Method::Meta' }
394 ## ------------------------------------------------------------------
397 $META->add_attribute('roles' => (
398 reader => 'get_roles',
399 default => sub { [] }
403 my ($self, $role) = @_;
404 (blessed($role) && $role->isa('Moose::Meta::Role'))
405 || Moose->throw_error("Roles must be instances of Moose::Meta::Role");
406 push @{$self->get_roles} => $role;
407 $self->reset_package_cache_flag;
410 sub calculate_all_roles {
416 $_->calculate_all_roles
417 } @{ $self->get_roles });
421 my ($self, $role) = @_;
423 || Moose->throw_error("You must supply a role name to look for");
424 my $role_name = blessed $role ? $role->name : $role;
425 # if we are it,.. then return true
426 return 1 if $role_name eq $self->name;
427 # otherwise.. check our children
428 foreach my $role (@{$self->get_roles}) {
429 return 1 if $role->does_role($role_name);
434 sub find_method_by_name { (shift)->get_method(@_) }
436 ## ------------------------------------------------------------------
438 ## ------------------------------------------------------------------
441 my ($self, $other, %args) = @_;
444 || Moose->throw_error("You must pass in an blessed instance");
446 my $application_class;
447 if ($other->isa('Moose::Meta::Role')) {
448 $application_class = $self->application_to_role_class;
450 elsif ($other->isa('Moose::Meta::Class')) {
451 $application_class = $self->application_to_class_class;
454 $application_class = $self->application_to_instance_class;
457 Class::MOP::load_class($application_class);
459 my $deprecation_check = 0;
461 if ( exists $args{excludes} && !exists $args{'-excludes'} ) {
462 $args{'-excludes'} = delete $args{excludes};
463 $deprecation_check = 1;
465 if ( exists $args{alias} && !exists $args{'-alias'} ) {
466 $args{'-alias'} = delete $args{alias};
467 $deprecation_check = 1;
470 if ( $deprecation_check ) {
471 Moose::Deprecated::deprecated(
472 feature => 'alias or excludes',
474 'The alias and excludes options for role application'.
475 ' have been renamed -alias and -excludes'.
476 " (${\$other->name} is consuming ${\$self->name}".
477 " - do you need to upgrade ${\$other->name}?)"
481 if ( exists $args{'-excludes'} ) {
482 # I wish we had coercion here :)
483 $args{'-excludes'} = (
484 ref $args{'-excludes'} eq 'ARRAY'
486 : [ $args{'-excludes'} ]
490 return $application_class->new(%args)->apply($self, $other, \%args);
493 sub composition_class_roles { }
496 my ($class, @role_specs) = @_;
498 require Moose::Meta::Role::Composite;
500 my (@roles, %role_params);
501 while (@role_specs) {
502 my ($role, $params) = @{ splice @role_specs, 0, 1 };
506 : Class::MOP::class_of($role);
508 my $actual_role = $requested_role->_role_for_combination($params);
509 push @roles => $actual_role;
511 next unless defined $params;
512 $role_params{$actual_role->name} = $params;
515 my $c = Moose::Meta::Role::Composite->new(roles => \@roles);
516 return $c->apply_params(\%role_params);
519 sub _role_for_combination {
520 my ($self, $params) = @_;
525 my ( $role, $package_name, %options ) = @_;
527 $options{package} = $package_name;
529 (ref $options{attributes} eq 'HASH')
530 || confess "You must pass a HASH ref of attributes"
531 if exists $options{attributes};
533 (ref $options{methods} eq 'HASH')
534 || confess "You must pass a HASH ref of methods"
535 if exists $options{methods};
537 $options{meta_name} = 'meta'
538 unless exists $options{meta_name};
540 my (%initialize_options) = %options;
541 delete @initialize_options{qw(
550 my $meta = $role->initialize( $package_name => %initialize_options );
552 $meta->_instantiate_module( $options{version}, $options{authority} );
554 $meta->_add_meta_method($options{meta_name})
555 if defined $options{meta_name};
557 if (exists $options{attributes}) {
558 foreach my $attribute_name (keys %{$options{attributes}}) {
559 my $attr = $options{attributes}->{$attribute_name};
560 $meta->add_attribute(
561 $attribute_name => blessed $attr ? $attr : %{$attr} );
565 if (exists $options{methods}) {
566 foreach my $method_name (keys %{$options{methods}}) {
567 $meta->add_method($method_name, $options{methods}->{$method_name});
577 for my $meta (Class::MOP::get_all_metaclass_instances) {
578 next if $meta->name eq $self->name;
579 next unless $meta->isa('Moose::Meta::Class')
580 || $meta->isa('Moose::Meta::Role');
581 push @consumers, $meta->name
582 if $meta->does_role($self->name);
587 # anonymous roles. most of it is copied straight out of Class::MOP::Class.
588 # an intrepid hacker might find great riches if he unifies this code with that
589 # code in Class::MOP::Module or Class::MOP::Package
592 # this should be sufficient, if you have a
593 # use case where it is not, write a test and
595 my $ANON_ROLE_SERIAL = 0;
598 # we need a sufficiently annoying prefix
599 # this should suffice for now, this is
600 # used in a couple of places below, so
601 # need to put it up here for now.
602 my $ANON_ROLE_PREFIX = 'Moose::Meta::Role::__ANON__::SERIAL::';
606 no warnings 'uninitialized';
607 $self->name =~ /^$ANON_ROLE_PREFIX/;
610 sub create_anon_role {
611 my ($role, %options) = @_;
612 $options{weaken} = 1 unless exists $options{weaken};
613 my $package_name = $ANON_ROLE_PREFIX . ++$ANON_ROLE_SERIAL;
614 return $role->create($package_name, %options);
618 # this will only get called for
619 # anon-roles, all other calls
620 # are assumed to occur during
621 # global destruction and so don't
622 # really need to be handled explicitly
626 return if in_global_destruction(); # it'll happen soon anyway and this just makes things more complicated
628 no warnings 'uninitialized';
629 return unless $self->name =~ /^$ANON_ROLE_PREFIX/;
631 # XXX: is this necessary for us? I don't understand what it's doing
634 # Moose does a weird thing where it replaces the metaclass for
635 # class when fixing metaclass incompatibility. In that case,
636 # we don't want to clean out the namespace now. We can detect
637 # that because Moose will explicitly update the singleton
638 # cache in Class::MOP.
639 #my $current_meta = Class::MOP::get_metaclass_by_name($self->name);
640 #return if $current_meta ne $self;
642 my ($serial_id) = ($self->name =~ /^$ANON_ROLE_PREFIX(\d+)/);
644 foreach my $key (keys %{$ANON_ROLE_PREFIX . $serial_id}) {
645 delete ${$ANON_ROLE_PREFIX . $serial_id}{$key};
647 delete ${'main::' . $ANON_ROLE_PREFIX}{$serial_id . '::'};
651 #####################################################################
653 ## This is Moose::Meta::Role as defined by Moose (plus the use of
654 ## MooseX::AttributeHelpers module). It is here as a reference to
655 ## make it easier to see what is happening above with all the meta
657 #####################################################################
660 # metaclass => 'Array',
661 # reader => 'get_roles',
662 # isa => 'ArrayRef[Moose::Meta::Role]',
663 # default => sub { [] },
665 # 'push' => 'add_role',
669 # has 'excluded_roles_map' => (
670 # metaclass => 'Hash',
671 # reader => 'get_excluded_roles_map',
672 # isa => 'HashRef[Str]',
674 # # Not exactly set, cause it sets multiple
675 # 'set' => 'add_excluded_roles',
676 # 'keys' => 'get_excluded_roles_list',
677 # 'exists' => 'excludes_role',
681 # has 'required_methods' => (
682 # metaclass => 'Hash',
683 # reader => 'get_required_methods_map',
684 # isa => 'HashRef[Moose::Meta::Role::Method::Required]',
686 # # not exactly set, or delete since it works for multiple
687 # 'set' => 'add_required_methods',
688 # 'delete' => 'remove_required_methods',
689 # 'keys' => 'get_required_method_list',
690 # 'exists' => 'requires_method',
694 # # the before, around and after modifiers are
695 # # HASH keyed by method-name, with ARRAY of
696 # # CODE refs to apply in that order
698 # has 'before_method_modifiers' => (
699 # metaclass => 'Hash',
700 # reader => 'get_before_method_modifiers_map',
701 # isa => 'HashRef[ArrayRef[CodeRef]]',
703 # 'keys' => 'get_before_method_modifiers',
704 # 'exists' => 'has_before_method_modifiers',
705 # # This actually makes sure there is an
706 # # ARRAY at the given key, and pushed onto
707 # # it. It also checks for duplicates as well
708 # # 'add' => 'add_before_method_modifier'
712 # has 'after_method_modifiers' => (
713 # metaclass => 'Hash',
714 # reader =>'get_after_method_modifiers_map',
715 # isa => 'HashRef[ArrayRef[CodeRef]]',
717 # 'keys' => 'get_after_method_modifiers',
718 # 'exists' => 'has_after_method_modifiers',
719 # # This actually makes sure there is an
720 # # ARRAY at the given key, and pushed onto
721 # # it. It also checks for duplicates as well
722 # # 'add' => 'add_after_method_modifier'
726 # has 'around_method_modifiers' => (
727 # metaclass => 'Hash',
728 # reader =>'get_around_method_modifiers_map',
729 # isa => 'HashRef[ArrayRef[CodeRef]]',
731 # 'keys' => 'get_around_method_modifiers',
732 # 'exists' => 'has_around_method_modifiers',
733 # # This actually makes sure there is an
734 # # ARRAY at the given key, and pushed onto
735 # # it. It also checks for duplicates as well
736 # # 'add' => 'add_around_method_modifier'
740 # # override is similar to the other modifiers
741 # # except that it is not an ARRAY of code refs
742 # # but instead just a single name->code mapping
744 # has 'override_method_modifiers' => (
745 # metaclass => 'Hash',
746 # reader =>'get_override_method_modifiers_map',
747 # isa => 'HashRef[CodeRef]',
749 # 'keys' => 'get_override_method_modifier',
750 # 'exists' => 'has_override_method_modifier',
751 # 'add' => 'add_override_method_modifier', # checks for local method ..
755 #####################################################################
766 Moose::Meta::Role - The Moose Role metaclass
770 This class is a subclass of L<Class::MOP::Module> that provides
771 additional Moose-specific functionality.
773 It's API looks a lot like L<Moose::Meta::Class>, but internally it
774 implements many things differently. This may change in the future.
778 C<Moose::Meta::Role> is a subclass of L<Class::MOP::Module>.
786 =item B<< Moose::Meta::Role->initialize($role_name) >>
788 This method creates a new role object with the provided name.
790 =item B<< Moose::Meta::Role->combine( [ $role => { ... } ], [ $role ], ... ) >>
792 This method accepts a list of array references. Each array reference
793 should contain a role name or L<Moose::Meta::Role> object as its first element. The second element is
794 an optional hash reference. The hash reference can contain C<-excludes>
795 and C<-alias> keys to control how methods are composed from the role.
797 The return value is a new L<Moose::Meta::Role::Composite> that
798 represents the combined roles.
800 =item B<< $metarole->composition_class_roles >>
802 When combining multiple roles using C<combine>, this method is used to obtain a
803 list of role names to be applied to the L<Moose::Meta::Role::Composite>
804 instance returned by C<combine>. The default implementation returns an empty
805 list. Extensions that need to hook into role combination may wrap this method
806 to return additional role names.
808 =item B<< Moose::Meta::Role->create($name, %options) >>
810 This method is identical to the L<Moose::Meta::Class> C<create>
813 =item B<< Moose::Meta::Role->create_anon_role >>
815 This method is identical to the L<Moose::Meta::Class>
816 C<create_anon_class> method.
818 =item B<< $metarole->is_anon_role >>
820 Returns true if the role is an anonymous role.
822 =item B<< $metarole->consumers >>
824 Returns a list of names of classes and roles which consume this role.
828 =head2 Role application
832 =item B<< $metarole->apply( $thing, @options ) >>
834 This method applies a role to the given C<$thing>. That can be another
835 L<Moose::Meta::Role>, object, a L<Moose::Meta::Class> object, or a
836 (non-meta) object instance.
838 The options are passed directly to the constructor for the appropriate
839 L<Moose::Meta::Role::Application> subclass.
841 Note that this will apply the role even if the C<$thing> in question already
842 C<does> this role. L<Moose::Util/does_role> is a convenient wrapper for
843 finding out if role application is necessary.
847 =head2 Roles and other roles
851 =item B<< $metarole->get_roles >>
853 This returns an array reference of roles which this role does. This
854 list may include duplicates.
856 =item B<< $metarole->calculate_all_roles >>
858 This returns a I<unique> list of all roles that this role does, and
859 all the roles that its roles do.
861 =item B<< $metarole->does_role($role) >>
863 Given a role I<name> or L<Moose::Meta::Role> object, returns true if this role
866 =item B<< $metarole->add_role($role) >>
868 Given a L<Moose::Meta::Role> object, this adds the role to the list of
869 roles that the role does.
871 =item B<< $metarole->get_excluded_roles_list >>
873 Returns a list of role names which this role excludes.
875 =item B<< $metarole->excludes_role($role_name) >>
877 Given a role I<name>, returns true if this role excludes the named
880 =item B<< $metarole->add_excluded_roles(@role_names) >>
882 Given one or more role names, adds those roles to the list of excluded
889 The methods for dealing with a role's methods are all identical in API
890 and behavior to the same methods in L<Class::MOP::Class>.
894 =item B<< $metarole->method_metaclass >>
896 Returns the method metaclass name for the role. This defaults to
897 L<Moose::Meta::Role::Method>.
899 =item B<< $metarole->get_method($name) >>
901 =item B<< $metarole->has_method($name) >>
903 =item B<< $metarole->add_method( $name, $body ) >>
905 =item B<< $metarole->get_method_list >>
907 =item B<< $metarole->find_method_by_name($name) >>
909 These methods are all identical to the methods of the same name in
910 L<Class::MOP::Package>
916 As with methods, the methods for dealing with a role's attribute are
917 all identical in API and behavior to the same methods in
918 L<Class::MOP::Class>.
920 However, attributes stored in this class are I<not> stored as
921 objects. Rather, the attribute definition is stored as a hash
922 reference. When a role is composed into a class, this hash reference
923 is passed directly to the metaclass's C<add_attribute> method.
925 This is quite likely to change in the future.
929 =item B<< $metarole->get_attribute($attribute_name) >>
931 =item B<< $metarole->has_attribute($attribute_name) >>
933 =item B<< $metarole->get_attribute_list >>
935 =item B<< $metarole->add_attribute($name, %options) >>
937 =item B<< $metarole->remove_attribute($attribute_name) >>
941 =head2 Required methods
945 =item B<< $metarole->get_required_method_list >>
947 Returns the list of methods required by the role.
949 =item B<< $metarole->requires_method($name) >>
951 Returns true if the role requires the named method.
953 =item B<< $metarole->add_required_methods(@names) >>
955 Adds the named methods to the role's list of required methods.
957 =item B<< $metarole->remove_required_methods(@names) >>
959 Removes the named methods from the role's list of required methods.
961 =item B<< $metarole->add_conflicting_method(%params) >>
963 Instantiate the parameters as a L<Moose::Meta::Role::Method::Conflicting>
964 object, then add it to the required method list.
968 =head2 Method modifiers
970 These methods act like their counterparts in L<Class::MOP::Class> and
971 L<Moose::Meta::Class>.
973 However, method modifiers are simply stored internally, and are not
974 applied until the role itself is applied to a class.
978 =item B<< $metarole->add_after_method_modifier($method_name, $method) >>
980 =item B<< $metarole->add_around_method_modifier($method_name, $method) >>
982 =item B<< $metarole->add_before_method_modifier($method_name, $method) >>
984 =item B<< $metarole->add_override_method_modifier($method_name, $method) >>
986 These methods all add an appropriate modifier to the internal list of
989 =item B<< $metarole->has_after_method_modifiers >>
991 =item B<< $metarole->has_around_method_modifiers >>
993 =item B<< $metarole->has_before_method_modifiers >>
995 =item B<< $metarole->has_override_method_modifier >>
997 Return true if the role has any modifiers of the given type.
999 =item B<< $metarole->get_after_method_modifiers($method_name) >>
1001 =item B<< $metarole->get_around_method_modifiers($method_name) >>
1003 =item B<< $metarole->get_before_method_modifiers($method_name) >>
1005 Given a method name, returns a list of the appropriate modifiers for
1008 =item B<< $metarole->get_override_method_modifier($method_name) >>
1010 Given a method name, returns the override method modifier for that
1011 method, if it has one.
1015 =head2 Introspection
1019 =item B<< Moose::Meta::Role->meta >>
1021 This will return a L<Class::MOP::Class> instance for this class.
1027 See L<Moose/BUGS> for details on reporting bugs.
1031 Stevan Little E<lt>stevan@iinteractive.comE<gt>
1033 =head1 COPYRIGHT AND LICENSE
1035 Copyright 2006-2010 by Infinity Interactive, Inc.
1037 L<http://www.iinteractive.com>
1039 This library is free software; you can redistribute it and/or modify
1040 it under the same terms as Perl itself.