default => sub { [] }
));
+__PACKAGE__->meta->add_attribute('role_applications' => (
+ reader => 'role_applications',
+ default => sub { [] }
+));
+
__PACKAGE__->meta->add_attribute(
Class::MOP::Attribute->new('immutable_trait' => (
push @{$self->roles} => $role;
}
+sub add_role_application {
+ my ($self, $application) = @_;
+ (blessed($application) && $application->isa('Moose::Meta::Role::Application::ToClass'))
+ || $self->throw_error("Role applications must be instances of Moose::Meta::Role::Application::ToClass", data => $application);
+ push @{$self->role_applications} => $application;
+}
+
sub calculate_all_roles {
my $self = shift;
my %seen;
$self->set_class($class);
$self->SUPER::apply($role, $class);
+
$class->add_role($role);
+ $class->add_role_application($self);
}
sub check_role_exclusions {