| Filename | /home/doy/coding/src/Moose/blib/lib//Moose/Meta/Role/Application/RoleSummation.pm |
| Statements | Executed 1084 statements in 20.6ms |
| Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
|---|---|---|---|---|---|
| 3 | 1 | 1 | 8.10ms | 53.7ms | Moose::Meta::Role::Application::RoleSummation::apply_methods |
| 22 | 2 | 1 | 1.55ms | 2.39ms | Moose::Meta::Role::Application::RoleSummation::get_method_aliases_for_role |
| 9 | 3 | 1 | 1.18ms | 3.51ms | Moose::Meta::Role::Application::RoleSummation::apply_method_modifiers |
| 3 | 1 | 1 | 927µs | 6.43ms | Moose::Meta::Role::Application::RoleSummation::check_required_methods |
| 3 | 1 | 1 | 887µs | 2.64ms | Moose::Meta::Role::Application::RoleSummation::apply_override_method_modifiers |
| 8 | 1 | 1 | 736µs | 1.12ms | Moose::Meta::Role::Application::RoleSummation::get_exclusions_for_role |
| 3 | 1 | 1 | 678µs | 1.18ms | Moose::Meta::Role::Application::RoleSummation::check_role_exclusions |
| 14 | 1 | 1 | 604µs | 2.08ms | Moose::Meta::Role::Application::RoleSummation::is_aliased_method |
| 3 | 1 | 1 | 270µs | 525µs | Moose::Meta::Role::Application::RoleSummation::apply_attributes |
| 1 | 1 | 1 | 72µs | 90µs | Moose::Meta::Role::Application::RoleSummation::BEGIN@3 |
| 1 | 1 | 1 | 49µs | 242µs | Moose::Meta::Role::Application::RoleSummation::BEGIN@7 |
| 1 | 1 | 1 | 41µs | 108µs | Moose::Meta::Role::Application::RoleSummation::BEGIN@4 |
| 1 | 1 | 1 | 40µs | 319µs | Moose::Meta::Role::Application::RoleSummation::BEGIN@15 |
| 1 | 1 | 1 | 38µs | 2.72ms | Moose::Meta::Role::Application::RoleSummation::BEGIN@5 |
| 1 | 1 | 1 | 27µs | 27µs | Moose::Meta::Role::Application::RoleSummation::BEGIN@9 |
| 3 | 1 | 1 | 22µs | 22µs | Moose::Meta::Role::Application::RoleSummation::check_required_attributes |
| 0 | 0 | 0 | 0s | 0s | Moose::Meta::Role::Application::RoleSummation::__ANON__[:19] |
| 0 | 0 | 0 | 0s | 0s | Moose::Meta::Role::Application::RoleSummation::is_method_aliased |
| 0 | 0 | 0 | 0s | 0s | Moose::Meta::Role::Application::RoleSummation::is_method_excluded |
| Line | State ments |
Time on line |
Calls | Time in subs |
Code |
|---|---|---|---|---|---|
| 1 | package Moose::Meta::Role::Application::RoleSummation; | ||||
| 2 | |||||
| 3 | 3 | 101µs | 2 | 109µs | # spent 90µs (72+18) within Moose::Meta::Role::Application::RoleSummation::BEGIN@3 which was called:
# once (72µs+18µs) by Moose::BEGIN@30 at line 3 # spent 90µs making 1 call to Moose::Meta::Role::Application::RoleSummation::BEGIN@3
# spent 18µs making 1 call to strict::import |
| 4 | 3 | 98µs | 2 | 175µs | # spent 108µs (41+67) within Moose::Meta::Role::Application::RoleSummation::BEGIN@4 which was called:
# once (41µs+67µs) by Moose::BEGIN@30 at line 4 # spent 108µs making 1 call to Moose::Meta::Role::Application::RoleSummation::BEGIN@4
# spent 67µs making 1 call to warnings::import |
| 5 | 3 | 145µs | 2 | 5.41ms | # spent 2.72ms (38µs+2.68) within Moose::Meta::Role::Application::RoleSummation::BEGIN@5 which was called:
# once (38µs+2.68ms) by Moose::BEGIN@30 at line 5 # spent 2.72ms making 1 call to Moose::Meta::Role::Application::RoleSummation::BEGIN@5
# spent 2.68ms making 1 call to metaclass::import |
| 6 | |||||
| 7 | 3 | 144µs | 2 | 434µs | # spent 242µs (49+193) within Moose::Meta::Role::Application::RoleSummation::BEGIN@7 which was called:
# once (49µs+193µs) by Moose::BEGIN@30 at line 7 # spent 242µs making 1 call to Moose::Meta::Role::Application::RoleSummation::BEGIN@7
# spent 193µs making 1 call to Exporter::import |
| 8 | |||||
| 9 | 3 | 235µs | 1 | 27µs | # spent 27µs within Moose::Meta::Role::Application::RoleSummation::BEGIN@9 which was called:
# once (27µs+0s) by Moose::BEGIN@30 at line 9 # spent 27µs making 1 call to Moose::Meta::Role::Application::RoleSummation::BEGIN@9 |
| 10 | |||||
| 11 | 1 | 5µs | our $VERSION = '1.19'; | ||
| 12 | 1 | 81µs | $VERSION = eval $VERSION; # spent 12µs executing statements in string eval | ||
| 13 | 1 | 3µs | our $AUTHORITY = 'cpan:STEVAN'; | ||
| 14 | |||||
| 15 | 3 | 4.58ms | 2 | 597µs | # spent 319µs (40+279) within Moose::Meta::Role::Application::RoleSummation::BEGIN@15 which was called:
# once (40µs+279µs) by Moose::BEGIN@30 at line 15 # spent 319µs making 1 call to Moose::Meta::Role::Application::RoleSummation::BEGIN@15
# spent 278µs making 1 call to base::import |
| 16 | |||||
| 17 | __PACKAGE__->meta->add_attribute('role_params' => ( | ||||
| 18 | reader => 'role_params', | ||||
| 19 | default => sub { {} } | ||||
| 20 | 1 | 34µs | 2 | 2.14ms | )); # spent 2.02ms making 1 call to Class::MOP::Mixin::HasAttributes::add_attribute
# spent 122µs making 1 call to Moose::Meta::Role::Application::RoleSummation::meta |
| 21 | |||||
| 22 | # spent 1.12ms (736µs+386µs) within Moose::Meta::Role::Application::RoleSummation::get_exclusions_for_role which was called 8 times, avg 140µs/call:
# 8 times (736µs+386µs) by Moose::Meta::Role::Application::RoleSummation::apply_methods at line 158, avg 140µs/call | ||||
| 23 | 8 | 30µs | my ($self, $role) = @_; | ||
| 24 | 8 | 260µs | 16 | 80µs | $role = $role->name if blessed $role; # spent 40µs making 8 calls to Scalar::Util::blessed, avg 5µs/call
# spent 40µs making 8 calls to Class::MOP::Package::name, avg 5µs/call |
| 25 | 8 | 103µs | 8 | 86µs | my $excludes_key = exists $self->role_params->{$role}->{'-excludes'} ? # spent 86µs making 8 calls to Moose::Meta::Role::Application::RoleSummation::role_params, avg 11µs/call |
| 26 | '-excludes' : 'excludes'; | ||||
| 27 | 8 | 159µs | 16 | 160µs | if ($self->role_params->{$role} && defined $self->role_params->{$role}->{$excludes_key}) { # spent 160µs making 16 calls to Moose::Meta::Role::Application::RoleSummation::role_params, avg 10µs/call |
| 28 | 3 | 869µs | 6 | 60µs | if (ref $self->role_params->{$role}->{$excludes_key} eq 'ARRAY') { # spent 60µs making 6 calls to Moose::Meta::Role::Application::RoleSummation::role_params, avg 10µs/call |
| 29 | return $self->role_params->{$role}->{$excludes_key}; | ||||
| 30 | } | ||||
| 31 | return [ $self->role_params->{$role}->{$excludes_key} ]; | ||||
| 32 | } | ||||
| 33 | 5 | 65µs | return []; | ||
| 34 | } | ||||
| 35 | |||||
| 36 | # spent 2.39ms (1.55+838µs) within Moose::Meta::Role::Application::RoleSummation::get_method_aliases_for_role which was called 22 times, avg 108µs/call:
# 14 times (915µs+498µs) by Moose::Meta::Role::Application::RoleSummation::is_aliased_method at line 62, avg 101µs/call
# 8 times (632µs+340µs) by Moose::Meta::Role::Application::RoleSummation::apply_methods at line 157, avg 122µs/call | ||||
| 37 | 22 | 77µs | my ($self, $role) = @_; | ||
| 38 | 22 | 462µs | 30 | 144µs | $role = $role->name if blessed $role; # spent 103µs making 22 calls to Scalar::Util::blessed, avg 5µs/call
# spent 41µs making 8 calls to Class::MOP::Package::name, avg 5µs/call |
| 39 | 22 | 294µs | 22 | 255µs | my $alias_key = exists $self->role_params->{$role}->{'-alias'} ? # spent 255µs making 22 calls to Moose::Meta::Role::Application::RoleSummation::role_params, avg 12µs/call |
| 40 | '-alias' : 'alias'; | ||||
| 41 | 22 | 424µs | 44 | 439µs | if ($self->role_params->{$role} && defined $self->role_params->{$role}->{$alias_key}) { # spent 439µs making 44 calls to Moose::Meta::Role::Application::RoleSummation::role_params, avg 10µs/call |
| 42 | return $self->role_params->{$role}->{$alias_key}; | ||||
| 43 | } | ||||
| 44 | 22 | 308µs | return {}; | ||
| 45 | } | ||||
| 46 | |||||
| 47 | sub is_method_excluded { | ||||
| 48 | my ($self, $role, $method_name) = @_; | ||||
| 49 | foreach ($self->get_exclusions_for_role($role->name)) { | ||||
| 50 | return 1 if $_ eq $method_name; | ||||
| 51 | } | ||||
| 52 | return 0; | ||||
| 53 | } | ||||
| 54 | |||||
| 55 | sub is_method_aliased { | ||||
| 56 | my ($self, $role, $method_name) = @_; | ||||
| 57 | exists $self->get_method_aliases_for_role($role->name)->{$method_name} ? 1 : 0 | ||||
| 58 | } | ||||
| 59 | |||||
| 60 | # spent 2.08ms (604µs+1.48) within Moose::Meta::Role::Application::RoleSummation::is_aliased_method which was called 14 times, avg 149µs/call:
# 14 times (604µs+1.48ms) by Moose::Meta::Role::Application::RoleSummation::check_required_methods at line 103, avg 149µs/call | ||||
| 61 | 14 | 58µs | my ($self, $role, $method_name) = @_; | ||
| 62 | 14 | 384µs | 28 | 1.48ms | my %aliased_names = reverse %{$self->get_method_aliases_for_role($role->name)}; # spent 1.41ms making 14 calls to Moose::Meta::Role::Application::RoleSummation::get_method_aliases_for_role, avg 101µs/call
# spent 65µs making 14 calls to Class::MOP::Package::name, avg 5µs/call |
| 63 | 14 | 191µs | exists $aliased_names{$method_name} ? 1 : 0; | ||
| 64 | } | ||||
| 65 | |||||
| 66 | # spent 1.18ms (678µs+497µs) within Moose::Meta::Role::Application::RoleSummation::check_role_exclusions which was called 3 times, avg 392µs/call:
# 3 times (678µs+497µs) by Moose::Meta::Role::Application::apply at line 50 of Moose/Meta/Role/Application.pm, avg 392µs/call | ||||
| 67 | 3 | 10µs | my ($self, $c) = @_; | ||
| 68 | |||||
| 69 | 3 | 6µs | my %excluded_roles; | ||
| 70 | 3 | 57µs | 3 | 40µs | for my $role (@{ $c->get_roles }) { # spent 40µs making 3 calls to Moose::Meta::Role::get_roles, avg 13µs/call |
| 71 | 8 | 155µs | 8 | 46µs | my $name = $role->name; # spent 46µs making 8 calls to Class::MOP::Package::name, avg 6µs/call |
| 72 | |||||
| 73 | 8 | 147µs | 8 | 326µs | for my $excluded ($role->get_excluded_roles_list) { # spent 326µs making 8 calls to Moose::Meta::Role::get_excluded_roles_list, avg 41µs/call |
| 74 | push @{ $excluded_roles{$excluded} }, $name; | ||||
| 75 | } | ||||
| 76 | } | ||||
| 77 | |||||
| 78 | 3 | 41µs | 3 | 31µs | foreach my $role (@{$c->get_roles}) { # spent 31µs making 3 calls to Moose::Meta::Role::get_roles, avg 10µs/call |
| 79 | 8 | 73µs | foreach my $excluded (keys %excluded_roles) { | ||
| 80 | next unless $role->does_role($excluded); | ||||
| 81 | |||||
| 82 | my @excluding = @{ $excluded_roles{$excluded} }; | ||||
| 83 | |||||
| 84 | require Moose; | ||||
| 85 | Moose->throw_error(sprintf "Conflict detected: Role%s %s exclude%s role '%s'", (@excluding == 1 ? '' : 's'), join(', ', @excluding), (@excluding == 1 ? 's' : ''), $excluded); | ||||
| 86 | } | ||||
| 87 | } | ||||
| 88 | |||||
| 89 | 3 | 172µs | 3 | 55µs | $c->add_excluded_roles(keys %excluded_roles); # spent 55µs making 3 calls to Moose::Meta::Role::add_excluded_roles, avg 18µs/call |
| 90 | } | ||||
| 91 | |||||
| 92 | # spent 6.43ms (927µs+5.50) within Moose::Meta::Role::Application::RoleSummation::check_required_methods which was called 3 times, avg 2.14ms/call:
# 3 times (927µs+5.50ms) by Moose::Meta::Role::Application::apply at line 51 of Moose/Meta/Role/Application.pm, avg 2.14ms/call | ||||
| 93 | 3 | 9µs | my ($self, $c) = @_; | ||
| 94 | |||||
| 95 | 5 | 61µs | 5 | 74µs | my %all_required_methods = # spent 74µs making 5 calls to Moose::Meta::Role::Method::Required::name, avg 15µs/call |
| 96 | 8 | 81µs | 8 | 290µs | map { $_->name => $_ } # spent 290µs making 8 calls to Moose::Meta::Role::get_required_method_list, avg 36µs/call |
| 97 | map { $_->get_required_method_list } | ||||
| 98 | 3 | 82µs | 3 | 30µs | @{$c->get_roles}; # spent 30µs making 3 calls to Moose::Meta::Role::get_roles, avg 10µs/call |
| 99 | |||||
| 100 | 3 | 44µs | 3 | 32µs | foreach my $role (@{$c->get_roles}) { # spent 32µs making 3 calls to Moose::Meta::Role::get_roles, avg 11µs/call |
| 101 | 8 | 80µs | foreach my $required (keys %all_required_methods) { | ||
| 102 | |||||
| 103 | 14 | 319µs | 28 | 4.62ms | delete $all_required_methods{$required} # spent 2.54ms making 14 calls to Class::MOP::Mixin::HasMethods::has_method, avg 181µs/call
# spent 2.08ms making 14 calls to Moose::Meta::Role::Application::RoleSummation::is_aliased_method, avg 149µs/call |
| 104 | if $role->has_method($required) | ||||
| 105 | || $self->is_aliased_method($role, $required); | ||||
| 106 | } | ||||
| 107 | } | ||||
| 108 | |||||
| 109 | 3 | 90µs | 3 | 452µs | $c->add_required_methods(values %all_required_methods); # spent 452µs making 3 calls to Moose::Meta::Role::add_required_methods, avg 151µs/call |
| 110 | } | ||||
| 111 | |||||
| 112 | 3 | 35µs | # spent 22µs within Moose::Meta::Role::Application::RoleSummation::check_required_attributes which was called 3 times, avg 7µs/call:
# 3 times (22µs+0s) by Moose::Meta::Role::Application::apply at line 52 of Moose/Meta/Role/Application.pm, avg 7µs/call | ||
| 113 | |||||
| 114 | } | ||||
| 115 | |||||
| 116 | # spent 525µs (270+254) within Moose::Meta::Role::Application::RoleSummation::apply_attributes which was called 3 times, avg 175µs/call:
# 3 times (270µs+254µs) by Moose::Meta::Role::Application::apply at line 54 of Moose/Meta/Role/Application.pm, avg 175µs/call | ||||
| 117 | 3 | 10µs | my ($self, $c) = @_; | ||
| 118 | |||||
| 119 | 3 | 7µs | my @all_attributes; | ||
| 120 | |||||
| 121 | 3 | 43µs | 3 | 34µs | for my $role ( @{ $c->get_roles } ) { # spent 34µs making 3 calls to Moose::Meta::Role::get_roles, avg 11µs/call |
| 122 | push @all_attributes, | ||||
| 123 | 8 | 116µs | 8 | 221µs | map { $role->get_attribute($_) } $role->get_attribute_list; # spent 221µs making 8 calls to Class::MOP::Mixin::HasAttributes::get_attribute_list, avg 28µs/call |
| 124 | } | ||||
| 125 | |||||
| 126 | 3 | 6µs | my %seen; | ||
| 127 | 3 | 15µs | foreach my $attr (@all_attributes) { | ||
| 128 | my $name = $attr->name; | ||||
| 129 | |||||
| 130 | if ( exists $seen{$name} ) { | ||||
| 131 | next if $seen{$name}->is_same_as($attr); | ||||
| 132 | |||||
| 133 | my $role1 = $seen{$name}->associated_role->name; | ||||
| 134 | my $role2 = $attr->associated_role->name; | ||||
| 135 | |||||
| 136 | require Moose; | ||||
| 137 | Moose->throw_error( | ||||
| 138 | "We have encountered an attribute conflict with '$name' " | ||||
| 139 | . "during role composition. " | ||||
| 140 | . " This attribute is defined in both $role1 and $role2." | ||||
| 141 | . " This is fatal error and cannot be disambiguated." ); | ||||
| 142 | } | ||||
| 143 | |||||
| 144 | $seen{$name} = $attr; | ||||
| 145 | } | ||||
| 146 | |||||
| 147 | 3 | 48µs | foreach my $attr (@all_attributes) { | ||
| 148 | $c->add_attribute( $attr->clone ); | ||||
| 149 | } | ||||
| 150 | } | ||||
| 151 | |||||
| 152 | # spent 53.7ms (8.10+45.6) within Moose::Meta::Role::Application::RoleSummation::apply_methods which was called 3 times, avg 17.9ms/call:
# 3 times (8.10ms+45.6ms) by Moose::Meta::Role::Application::apply at line 55 of Moose/Meta/Role/Application.pm, avg 17.9ms/call | ||||
| 153 | 3 | 10µs | my ($self, $c) = @_; | ||
| 154 | |||||
| 155 | 8 | 21µs | my @all_methods = map { | ||
| 156 | my $role = $_; | ||||
| 157 | 8 | 92µs | 8 | 972µs | my $aliases = $self->get_method_aliases_for_role($role); # spent 972µs making 8 calls to Moose::Meta::Role::Application::RoleSummation::get_method_aliases_for_role, avg 122µs/call |
| 158 | 8 | 146µs | 8 | 1.12ms | my %excludes = map { $_ => undef } @{ $self->get_exclusions_for_role($role) }; # spent 1.12ms making 8 calls to Moose::Meta::Role::Application::RoleSummation::get_exclusions_for_role, avg 140µs/call |
| 159 | ( | ||||
| 160 | 80 | 1.39ms | 76 | 5.91ms | (map { # spent 5.91ms making 76 calls to Class::MOP::Mixin::HasMethods::get_method, avg 78µs/call |
| 161 | 80 | 1.27ms | 80 | 352µs | exists $excludes{$_} ? () : # spent 352µs making 80 calls to Class::MOP::Method::name, avg 4µs/call |
| 162 | +{ | ||||
| 163 | role => $role, | ||||
| 164 | name => $_, | ||||
| 165 | method => $role->get_method($_), | ||||
| 166 | } | ||||
| 167 | 88 | 1.72ms | 88 | 651µs | } map { $_->name } # spent 651µs making 88 calls to UNIVERSAL::isa, avg 7µs/call |
| 168 | grep { !$_->isa('Class::MOP::Method::Meta') } | ||||
| 169 | $role->_get_local_methods), | ||||
| 170 | (map { | ||||
| 171 | 8 | 806µs | 8 | 18.7ms | +{ # spent 18.7ms making 8 calls to Class::MOP::Mixin::HasMethods::_get_local_methods, avg 2.34ms/call |
| 172 | role => $role, | ||||
| 173 | name => $aliases->{$_}, | ||||
| 174 | method => $role->get_method($_), | ||||
| 175 | } | ||||
| 176 | } keys %$aliases) | ||||
| 177 | ); | ||||
| 178 | 3 | 155µs | 3 | 29µs | } @{$c->get_roles}; # spent 29µs making 3 calls to Moose::Meta::Role::get_roles, avg 10µs/call |
| 179 | |||||
| 180 | 3 | 9µs | my (%seen, %method_map); | ||
| 181 | 3 | 24µs | foreach my $method (@all_methods) { | ||
| 182 | 76 | 201µs | my $seen = $seen{$method->{name}}; | ||
| 183 | |||||
| 184 | 76 | 179µs | if ($seen) { | ||
| 185 | 2 | 86µs | 4 | 25µs | if ($seen->{method}->body != $method->{method}->body) { # spent 25µs making 4 calls to Class::MOP::Method::body, avg 6µs/call |
| 186 | 2 | 116µs | 6 | 996µs | $c->add_conflicting_method( # spent 976µs making 2 calls to Moose::Meta::Role::add_conflicting_method, avg 488µs/call
# spent 20µs making 4 calls to Class::MOP::Package::name, avg 5µs/call |
| 187 | name => $method->{name}, | ||||
| 188 | roles => [$method->{role}->name, $seen->{role}->name], | ||||
| 189 | ); | ||||
| 190 | |||||
| 191 | 2 | 11µs | delete $method_map{$method->{name}}; | ||
| 192 | 2 | 8µs | next; | ||
| 193 | } | ||||
| 194 | } | ||||
| 195 | |||||
| 196 | 74 | 235µs | $seen{$method->{name}} = $method; | ||
| 197 | 74 | 374µs | $method_map{$method->{name}} = $method->{method}; | ||
| 198 | } | ||||
| 199 | |||||
| 200 | 6 | 1.08ms | 72 | 16.8ms | $c->add_method($_ => $method_map{$_}) for keys %method_map; # spent 16.8ms making 72 calls to Moose::Meta::Role::Composite::add_method, avg 233µs/call |
| 201 | } | ||||
| 202 | |||||
| 203 | # spent 2.64ms (887µs+1.75) within Moose::Meta::Role::Application::RoleSummation::apply_override_method_modifiers which was called 3 times, avg 880µs/call:
# 3 times (887µs+1.75ms) by Moose::Meta::Role::Application::apply at line 57 of Moose/Meta/Role/Application.pm, avg 880µs/call | ||||
| 204 | 3 | 11µs | my ($self, $c) = @_; | ||
| 205 | |||||
| 206 | 8 | 18µs | my @all_overrides = map { | ||
| 207 | my $role = $_; | ||||
| 208 | 9 | 134µs | 9 | 308µs | map { # spent 308µs making 9 calls to Moose::Meta::Role::get_override_method_modifier, avg 34µs/call |
| 209 | 8 | 111µs | 8 | 331µs | +{ # spent 331µs making 8 calls to Moose::Meta::Role::get_method_modifier_list, avg 41µs/call |
| 210 | name => $_, | ||||
| 211 | method => $role->get_override_method_modifier($_), | ||||
| 212 | } | ||||
| 213 | } $role->get_method_modifier_list('override'); | ||||
| 214 | 3 | 72µs | 3 | 39µs | } @{$c->get_roles}; # spent 39µs making 3 calls to Moose::Meta::Role::get_roles, avg 13µs/call |
| 215 | |||||
| 216 | 3 | 6µs | my %seen; | ||
| 217 | 3 | 19µs | foreach my $override (@all_overrides) { | ||
| 218 | 9 | 104µs | 9 | 325µs | if ( $c->has_method($override->{name}) ){ # spent 325µs making 9 calls to Moose::Meta::Role::Composite::has_method, avg 36µs/call |
| 219 | require Moose; | ||||
| 220 | Moose->throw_error( "Role '" . $c->name . "' has encountered an 'override' method conflict " . | ||||
| 221 | "during composition (A local method of the same name as been found). This " . | ||||
| 222 | "is fatal error." ) | ||||
| 223 | } | ||||
| 224 | 9 | 27µs | if (exists $seen{$override->{name}}) { | ||
| 225 | if ( $seen{$override->{name}} != $override->{method} ) { | ||||
| 226 | require Moose; | ||||
| 227 | Moose->throw_error( "We have encountered an 'override' method conflict during " . | ||||
| 228 | "composition (Two 'override' methods of the same name encountered). " . | ||||
| 229 | "This is fatal error.") | ||||
| 230 | } | ||||
| 231 | } | ||||
| 232 | 9 | 67µs | $seen{$override->{name}} = $override->{method}; | ||
| 233 | } | ||||
| 234 | |||||
| 235 | $c->add_override_method_modifier( | ||||
| 236 | $_->{name}, $_->{method} | ||||
| 237 | 6 | 204µs | 9 | 750µs | ) for @all_overrides; # spent 750µs making 9 calls to Moose::Meta::Role::add_override_method_modifier, avg 83µs/call |
| 238 | |||||
| 239 | } | ||||
| 240 | |||||
| 241 | # spent 3.51ms (1.18+2.33) within Moose::Meta::Role::Application::RoleSummation::apply_method_modifiers which was called 9 times, avg 390µs/call:
# 3 times (613µs+1.64ms) by Moose::Meta::Role::Application::apply_around_method_modifiers at line 74 of Moose/Meta/Role/Application.pm, avg 750µs/call
# 3 times (306µs+356µs) by Moose::Meta::Role::Application::apply_before_method_modifiers at line 73 of Moose/Meta/Role/Application.pm, avg 221µs/call
# 3 times (258µs+339µs) by Moose::Meta::Role::Application::apply_after_method_modifiers at line 75 of Moose/Meta/Role/Application.pm, avg 199µs/call | ||||
| 242 | 9 | 33µs | my ($self, $modifier_type, $c) = @_; | ||
| 243 | 9 | 37µs | my $add = "add_${modifier_type}_method_modifier"; | ||
| 244 | 9 | 28µs | my $get = "get_${modifier_type}_method_modifiers"; | ||
| 245 | 9 | 204µs | 9 | 93µs | foreach my $role (@{$c->get_roles}) { # spent 93µs making 9 calls to Moose::Meta::Role::get_roles, avg 10µs/call |
| 246 | 24 | 427µs | 24 | 948µs | foreach my $method_name ($role->get_method_modifier_list($modifier_type)) { # spent 948µs making 24 calls to Moose::Meta::Role::get_method_modifier_list, avg 40µs/call |
| 247 | $c->$add( | ||||
| 248 | $method_name, | ||||
| 249 | $_ | ||||
| 250 | 18 | 313µs | 18 | 1.29ms | ) foreach $role->$get($method_name); # spent 912µs making 9 calls to Moose::Meta::Role::add_around_method_modifier, avg 101µs/call
# spent 379µs making 9 calls to Moose::Meta::Role::get_around_method_modifiers, avg 42µs/call |
| 251 | } | ||||
| 252 | } | ||||
| 253 | } | ||||
| 254 | |||||
| 255 | 1 | 27µs | 1; | ||
| 256 | |||||
| 257 | __END__ |