| Filename | /home/doy/perl5/perlbrew/perls/perl-5.10.1/lib/site_perl/5.10.1/x86_64-linux/Moose/Meta/Role/Application/ToRole.pm |
| Statements | Executed 13036 statements in 200ms |
| Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
|---|---|---|---|---|---|
| 111 | 1 | 1 | 128ms | 1.54s | Moose::Meta::Role::Application::ToRole::apply_methods |
| 333 | 3 | 1 | 20.5ms | 67.0ms | Moose::Meta::Role::Application::ToRole::apply_method_modifiers |
| 111 | 1 | 1 | 16.7ms | 148ms | Moose::Meta::Role::Application::ToRole::apply_override_method_modifiers |
| 111 | 1 | 1 | 7.11ms | 63.8ms | Moose::Meta::Role::Application::ToRole::check_required_methods |
| 111 | 1 | 1 | 6.62ms | 16.6ms | Moose::Meta::Role::Application::ToRole::check_role_exclusions |
| 111 | 1 | 1 | 6.19ms | 1.90s | Moose::Meta::Role::Application::ToRole::apply |
| 111 | 1 | 1 | 4.29ms | 17.1ms | Moose::Meta::Role::Application::ToRole::apply_attributes |
| 111 | 1 | 1 | 824µs | 824µs | Moose::Meta::Role::Application::ToRole::check_required_attributes |
| 1 | 1 | 1 | 79µs | 97µs | Moose::Meta::Role::Application::ToRole::BEGIN@3 |
| 1 | 1 | 1 | 43µs | 242µs | Moose::Meta::Role::Application::ToRole::BEGIN@7 |
| 1 | 1 | 1 | 40µs | 287µs | Moose::Meta::Role::Application::ToRole::BEGIN@13 |
| 1 | 1 | 1 | 39µs | 108µs | Moose::Meta::Role::Application::ToRole::BEGIN@4 |
| 1 | 1 | 1 | 39µs | 3.15ms | Moose::Meta::Role::Application::ToRole::BEGIN@5 |
| Line | State ments |
Time on line |
Calls | Time in subs |
Code |
|---|---|---|---|---|---|
| 1 | package Moose::Meta::Role::Application::ToRole; | ||||
| 2 | |||||
| 3 | 3 | 106µs | 2 | 115µs | # spent 97µs (79+18) within Moose::Meta::Role::Application::ToRole::BEGIN@3 which was called:
# once (79µs+18µs) by Moose::BEGIN@32 at line 3 # spent 97µs making 1 call to Moose::Meta::Role::Application::ToRole::BEGIN@3
# spent 18µs making 1 call to strict::import |
| 4 | 3 | 96µs | 2 | 178µs | # spent 108µs (39+69) within Moose::Meta::Role::Application::ToRole::BEGIN@4 which was called:
# once (39µs+69µs) by Moose::BEGIN@32 at line 4 # spent 108µs making 1 call to Moose::Meta::Role::Application::ToRole::BEGIN@4
# spent 69µs making 1 call to warnings::import |
| 5 | 3 | 156µs | 2 | 6.26ms | # spent 3.15ms (39µs+3.11) within Moose::Meta::Role::Application::ToRole::BEGIN@5 which was called:
# once (39µs+3.11ms) by Moose::BEGIN@32 at line 5 # spent 3.15ms making 1 call to Moose::Meta::Role::Application::ToRole::BEGIN@5
# spent 3.11ms making 1 call to metaclass::import |
| 6 | |||||
| 7 | 3 | 280µs | 2 | 440µs | # spent 242µs (43+199) within Moose::Meta::Role::Application::ToRole::BEGIN@7 which was called:
# once (43µs+199µs) by Moose::BEGIN@32 at line 7 # spent 242µs making 1 call to Moose::Meta::Role::Application::ToRole::BEGIN@7
# spent 199µs making 1 call to Exporter::import |
| 8 | |||||
| 9 | 1 | 5µs | our $VERSION = '1.19'; | ||
| 10 | 1 | 64µs | $VERSION = eval $VERSION; # spent 12µs executing statements in string eval | ||
| 11 | 1 | 3µs | our $AUTHORITY = 'cpan:STEVAN'; | ||
| 12 | |||||
| 13 | 3 | 2.64ms | 2 | 534µs | # spent 287µs (40+247) within Moose::Meta::Role::Application::ToRole::BEGIN@13 which was called:
# once (40µs+247µs) by Moose::BEGIN@32 at line 13 # spent 287µs making 1 call to Moose::Meta::Role::Application::ToRole::BEGIN@13
# spent 247µs making 1 call to base::import |
| 14 | |||||
| 15 | # spent 1.90s (6.19ms+1.89) within Moose::Meta::Role::Application::ToRole::apply which was called 111 times, avg 17.1ms/call:
# 111 times (6.19ms+1.89s) by Moose::Meta::Role::apply at line 483 of Moose/Meta/Role.pm, avg 17.1ms/call | ||||
| 16 | 333 | 5.92ms | my ($self, $role1, $role2) = @_; | ||
| 17 | 111 | 1.88s | $self->SUPER::apply($role1, $role2); # spent 1.88s making 111 calls to Moose::Meta::Role::Application::apply, avg 16.9ms/call | ||
| 18 | 111 | 11.3ms | $role2->add_role($role1); # spent 11.3ms making 111 calls to Moose::Meta::Role::add_role, avg 102µs/call | ||
| 19 | } | ||||
| 20 | |||||
| 21 | # spent 16.6ms (6.62+10.0) within Moose::Meta::Role::Application::ToRole::check_role_exclusions which was called 111 times, avg 150µs/call:
# 111 times (6.62ms+10.0ms) by Moose::Meta::Role::Application::apply at line 50 of Moose/Meta/Role/Application.pm, avg 150µs/call | ||||
| 22 | 333 | 7.07ms | my ($self, $role1, $role2) = @_; | ||
| 23 | 222 | 5.76ms | if ( $role2->excludes_role($role1->name) ) { # spent 4.91ms making 111 calls to Moose::Meta::Role::excludes_role, avg 44µs/call
# spent 719µs making 102 calls to Class::MOP::Package::name, avg 7µs/call
# spent 133µs making 9 calls to Moose::Meta::Role::Composite::name, avg 15µs/call | ||
| 24 | require Moose; | ||||
| 25 | Moose->throw_error("Conflict detected: " . $role2->name . " excludes role '" . $role1->name . "'"); | ||||
| 26 | } | ||||
| 27 | 111 | 4.25ms | foreach my $excluded_role_name ($role1->get_excluded_roles_list) { # spent 4.25ms making 111 calls to Moose::Meta::Role::get_excluded_roles_list, avg 38µs/call | ||
| 28 | if ( $role2->does_role($excluded_role_name) ) { | ||||
| 29 | require Moose; | ||||
| 30 | Moose->throw_error("The class " . $role2->name . " does the excluded role '$excluded_role_name'"); | ||||
| 31 | } | ||||
| 32 | $role2->add_excluded_roles($excluded_role_name); | ||||
| 33 | } | ||||
| 34 | } | ||||
| 35 | |||||
| 36 | # spent 63.8ms (7.11+56.7) within Moose::Meta::Role::Application::ToRole::check_required_methods which was called 111 times, avg 575µs/call:
# 111 times (7.11ms+56.7ms) by Moose::Meta::Role::Application::apply at line 51 of Moose/Meta/Role/Application.pm, avg 575µs/call | ||||
| 37 | 222 | 3.10ms | my ($self, $role1, $role2) = @_; | ||
| 38 | 111 | 4.53ms | foreach my $required_method ($role1->get_required_method_list) { # spent 4.53ms making 111 calls to Moose::Meta::Role::get_required_method_list, avg 41µs/call | ||
| 39 | 228 | 3.50ms | 76 | 1.26ms | my $required_method_name = $required_method->name; # spent 1.26ms making 76 calls to Moose::Meta::Role::Method::Required::name, avg 17µs/call |
| 40 | |||||
| 41 | 76 | 3.44ms | next if $self->is_aliased_method($required_method_name); # spent 3.44ms making 76 calls to Moose::Meta::Role::Application::is_aliased_method, avg 45µs/call | ||
| 42 | |||||
| 43 | 80 | 47.5ms | $role2->add_required_methods($required_method) # spent 47.1ms making 76 calls to Moose::Meta::Role::find_method_by_name, avg 620µs/call
# spent 387µs making 4 calls to Moose::Meta::Role::add_required_methods, avg 97µs/call | ||
| 44 | unless $role2->find_method_by_name($required_method_name); | ||||
| 45 | } | ||||
| 46 | } | ||||
| 47 | |||||
| 48 | 111 | 1.30ms | # spent 824µs within Moose::Meta::Role::Application::ToRole::check_required_attributes which was called 111 times, avg 7µs/call:
# 111 times (824µs+0s) by Moose::Meta::Role::Application::apply at line 52 of Moose/Meta/Role/Application.pm, avg 7µs/call | ||
| 49 | |||||
| 50 | } | ||||
| 51 | |||||
| 52 | # spent 17.1ms (4.29+12.8) within Moose::Meta::Role::Application::ToRole::apply_attributes which was called 111 times, avg 154µs/call:
# 111 times (4.29ms+12.8ms) by Moose::Meta::Role::Application::apply at line 54 of Moose/Meta/Role/Application.pm, avg 154µs/call | ||||
| 53 | 222 | 3.30ms | my ($self, $role1, $role2) = @_; | ||
| 54 | 111 | 4.28ms | foreach my $attribute_name ($role1->get_attribute_list) { # spent 4.28ms making 111 calls to Class::MOP::Mixin::HasAttributes::get_attribute_list, avg 39µs/call | ||
| 55 | # it if it has one already | ||||
| 56 | 30 | 765µs | 15 | 541µs | if ($role2->has_attribute($attribute_name) && # spent 541µs making 15 calls to Class::MOP::Mixin::HasAttributes::has_attribute, avg 36µs/call |
| 57 | # make sure we haven't seen this one already too | ||||
| 58 | $role2->get_attribute($attribute_name) != $role1->get_attribute($attribute_name)) { | ||||
| 59 | |||||
| 60 | my $role2_name = $role2->name; | ||||
| 61 | |||||
| 62 | require Moose; | ||||
| 63 | Moose->throw_error( "Role '" | ||||
| 64 | . $role1->name | ||||
| 65 | . "' has encountered an attribute conflict" | ||||
| 66 | . " while being composed into '$role2_name'." | ||||
| 67 | . " This is a fatal error and cannot be disambiguated." | ||||
| 68 | . " The conflicting attribute is named '$attribute_name'." ); | ||||
| 69 | } | ||||
| 70 | else { | ||||
| 71 | 45 | 7.95ms | $role2->add_attribute( # spent 5.60ms making 15 calls to Moose::Meta::Role::add_attribute, avg 373µs/call
# spent 1.79ms making 15 calls to Moose::Meta::Role::Attribute::clone, avg 119µs/call
# spent 559µs making 15 calls to Class::MOP::Mixin::HasAttributes::get_attribute, avg 37µs/call | ||
| 72 | $role1->get_attribute($attribute_name)->clone | ||||
| 73 | ); | ||||
| 74 | } | ||||
| 75 | } | ||||
| 76 | } | ||||
| 77 | |||||
| 78 | # spent 1.54s (128ms+1.41) within Moose::Meta::Role::Application::ToRole::apply_methods which was called 111 times, avg 13.9ms/call:
# 111 times (128ms+1.41s) by Moose::Meta::Role::Application::apply at line 55 of Moose/Meta/Role/Application.pm, avg 13.9ms/call | ||||
| 79 | 222 | 3.27ms | my ( $self, $role1, $role2 ) = @_; | ||
| 80 | 111 | 349ms | foreach my $method ( $role1->_get_local_methods ) { # spent 349ms making 102 calls to Class::MOP::Mixin::HasMethods::_get_local_methods, avg 3.42ms/call
# spent 467µs making 9 calls to Moose::Meta::Role::Composite::_get_local_methods, avg 52µs/call | ||
| 81 | |||||
| 82 | 5260 | 103ms | 1366 | 8.40ms | my $method_name = $method->name; # spent 8.40ms making 1366 calls to Class::MOP::Method::name, avg 6µs/call |
| 83 | |||||
| 84 | 1366 | 14.6ms | next if $method->isa('Class::MOP::Method::Meta'); # spent 14.6ms making 1366 calls to UNIVERSAL::isa, avg 11µs/call | ||
| 85 | |||||
| 86 | 2278 | 18.9ms | 1264 | 68.5ms | unless ( $self->is_method_excluded($method_name) ) { # spent 68.5ms making 1264 calls to Moose::Meta::Role::Application::is_method_excluded, avg 54µs/call |
| 87 | |||||
| 88 | 1139 | 338ms | my $role2_method = $role2->get_method($method_name); # spent 338ms making 1139 calls to Class::MOP::Mixin::HasMethods::get_method, avg 296µs/call | ||
| 89 | 1139 | 13.5ms | if ( $role2_method | ||
| 90 | && $role2_method->body != $method->body ) { | ||||
| 91 | |||||
| 92 | # method conflicts between roles result in the method becoming | ||||
| 93 | # a requirement | ||||
| 94 | $role2->add_conflicting_method( | ||||
| 95 | name => $method_name, | ||||
| 96 | roles => [ $role1->name, $role2->name ], | ||||
| 97 | ); | ||||
| 98 | } | ||||
| 99 | else { | ||||
| 100 | 1139 | 583ms | $role2->add_method( # spent 583ms making 1139 calls to Class::MOP::Mixin::HasMethods::add_method, avg 512µs/call | ||
| 101 | $method_name, | ||||
| 102 | $method, | ||||
| 103 | ); | ||||
| 104 | } | ||||
| 105 | } | ||||
| 106 | |||||
| 107 | 1264 | 53.3ms | next unless $self->is_method_aliased($method_name); # spent 53.3ms making 1264 calls to Moose::Meta::Role::Application::is_method_aliased, avg 42µs/call | ||
| 108 | |||||
| 109 | my $aliased_method_name = $self->get_method_aliases->{$method_name}; | ||||
| 110 | |||||
| 111 | my $role2_method = $role2->get_method($aliased_method_name); | ||||
| 112 | |||||
| 113 | if ( $role2_method | ||||
| 114 | && $role2_method->body != $method->body ) { | ||||
| 115 | |||||
| 116 | require Moose; | ||||
| 117 | Moose->throw_error( | ||||
| 118 | "Cannot create a method alias if a local method of the same name exists" | ||||
| 119 | ); | ||||
| 120 | } | ||||
| 121 | |||||
| 122 | $role2->add_method( | ||||
| 123 | $aliased_method_name, | ||||
| 124 | $role1->get_method($method_name) | ||||
| 125 | ); | ||||
| 126 | |||||
| 127 | if ( !$role2->has_method($method_name) ) { | ||||
| 128 | $role2->add_required_methods($method_name) | ||||
| 129 | unless $self->is_method_excluded($method_name); | ||||
| 130 | } | ||||
| 131 | } | ||||
| 132 | } | ||||
| 133 | |||||
| 134 | # spent 148ms (16.7+131) within Moose::Meta::Role::Application::ToRole::apply_override_method_modifiers which was called 111 times, avg 1.33ms/call:
# 111 times (16.7ms+131ms) by Moose::Meta::Role::Application::apply at line 57 of Moose/Meta/Role/Application.pm, avg 1.33ms/call | ||||
| 135 | 222 | 3.48ms | my ($self, $role1, $role2) = @_; | ||
| 136 | 111 | 5.35ms | foreach my $method_name ($role1->get_method_modifier_list('override')) { # spent 5.35ms making 111 calls to Moose::Meta::Role::get_method_modifier_list, avg 48µs/call | ||
| 137 | # it if it has one already then ... | ||||
| 138 | 418 | 6.58ms | 209 | 59.7ms | if ($role2->has_method($method_name)) { # spent 59.7ms making 209 calls to Class::MOP::Mixin::HasMethods::has_method, avg 285µs/call |
| 139 | # if it is being composed into another role | ||||
| 140 | # we have a conflict here, because you cannot | ||||
| 141 | # combine an overridden method with a locally | ||||
| 142 | # defined one | ||||
| 143 | require Moose; | ||||
| 144 | Moose->throw_error("Role '" . $role1->name . "' has encountered an 'override' method conflict " . | ||||
| 145 | "during composition (A local method of the same name as been found). This " . | ||||
| 146 | "is fatal error."); | ||||
| 147 | } | ||||
| 148 | else { | ||||
| 149 | # if we are a role, we need to make sure | ||||
| 150 | # we dont have a conflict with the role | ||||
| 151 | # we are composing into | ||||
| 152 | 209 | 4.31ms | 209 | 7.79ms | if ($role2->has_override_method_modifier($method_name) && # spent 7.79ms making 209 calls to Moose::Meta::Role::has_override_method_modifier, avg 37µs/call |
| 153 | $role2->get_override_method_modifier($method_name) != $role2->get_override_method_modifier($method_name)) { | ||||
| 154 | |||||
| 155 | require Moose; | ||||
| 156 | Moose->throw_error("Role '" . $role1->name . "' has encountered an 'override' method conflict " . | ||||
| 157 | "during composition (Two 'override' methods of the same name encountered). " . | ||||
| 158 | "This is fatal error."); | ||||
| 159 | } | ||||
| 160 | else { | ||||
| 161 | # if there is no conflict, | ||||
| 162 | # just add it to the role | ||||
| 163 | 418 | 58.6ms | $role2->add_override_method_modifier( # spent 51.0ms making 209 calls to Moose::Meta::Role::add_override_method_modifier, avg 244µs/call
# spent 7.54ms making 209 calls to Moose::Meta::Role::get_override_method_modifier, avg 36µs/call | ||
| 164 | $method_name, | ||||
| 165 | $role1->get_override_method_modifier($method_name) | ||||
| 166 | ); | ||||
| 167 | } | ||||
| 168 | } | ||||
| 169 | } | ||||
| 170 | } | ||||
| 171 | |||||
| 172 | # spent 67.0ms (20.5+46.5) within Moose::Meta::Role::Application::ToRole::apply_method_modifiers which was called 333 times, avg 201µs/call:
# 111 times (12.2ms+35.0ms) by Moose::Meta::Role::Application::apply_around_method_modifiers at line 74 of Moose/Meta/Role/Application.pm, avg 425µs/call
# 111 times (4.57ms+6.24ms) by Moose::Meta::Role::Application::apply_before_method_modifiers at line 73 of Moose/Meta/Role/Application.pm, avg 97µs/call
# 111 times (3.74ms+5.32ms) by Moose::Meta::Role::Application::apply_after_method_modifiers at line 75 of Moose/Meta/Role/Application.pm, avg 82µs/call | ||||
| 173 | 1332 | 11.2ms | my ($self, $modifier_type, $role1, $role2) = @_; | ||
| 174 | my $add = "add_${modifier_type}_method_modifier"; | ||||
| 175 | my $get = "get_${modifier_type}_method_modifiers"; | ||||
| 176 | 333 | 13.9ms | foreach my $method_name ($role1->get_method_modifier_list($modifier_type)) { # spent 13.9ms making 333 calls to Moose::Meta::Role::get_method_modifier_list, avg 42µs/call | ||
| 177 | $role2->$add( | ||||
| 178 | $method_name, | ||||
| 179 | $_ | ||||
| 180 | 458 | 7.88ms | 460 | 32.7ms | ) foreach $role1->$get($method_name); # spent 21.6ms making 216 calls to Moose::Meta::Role::add_around_method_modifier, avg 100µs/call
# spent 8.83ms making 214 calls to Moose::Meta::Role::get_around_method_modifiers, avg 41µs/call
# spent 1.01ms making 10 calls to Moose::Meta::Role::add_before_method_modifier, avg 101µs/call
# spent 501µs making 5 calls to Moose::Meta::Role::add_after_method_modifier, avg 100µs/call
# spent 415µs making 10 calls to Moose::Meta::Role::get_before_method_modifiers, avg 41µs/call
# spent 268µs making 5 calls to Moose::Meta::Role::get_after_method_modifiers, avg 54µs/call |
| 181 | } | ||||
| 182 | } | ||||
| 183 | |||||
| 184 | |||||
| 185 | 1 | 12µs | 1; | ||
| 186 | |||||
| 187 | __END__ |