| Filename | /Users/dde/perl5/perlbrew/perls/5.18.0t/lib/site_perl/5.18.0/darwin-thread-multi-2level/Moose/Role.pm |
| Statements | Executed 708 statements in 1.58ms |
| Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
|---|---|---|---|---|---|
| 12 | 7 | 5 | 3.35ms | 3.68ms | Moose::Role::around |
| 19 | 1 | 1 | 387µs | 21.9ms | Moose::Role::init_meta |
| 38 | 15 | 3 | 290µs | 9.99ms | Moose::Role::has |
| 52 | 2 | 1 | 112µs | 2.73ms | Moose::Role::super |
| 22 | 12 | 12 | 88µs | 204ms | Moose::Role::with (recurses: max depth 2, inclusive time 38.0ms) |
| 12 | 7 | 6 | 55µs | 555µs | Moose::Role::requires |
| 9 | 3 | 1 | 28µs | 219µs | Moose::Role::_add_method_modifier |
| 6 | 4 | 2 | 25µs | 213µs | Moose::Role::override |
| 4 | 3 | 2 | 17µs | 141µs | Moose::Role::before |
| 2 | 2 | 2 | 10µs | 68µs | Moose::Role::after |
| 1 | 1 | 1 | 8µs | 8µs | Moose::Role::BEGIN@2 |
| 1 | 1 | 1 | 6µs | 27µs | Moose::Role::BEGIN@11 |
| 1 | 1 | 1 | 6µs | 1.11ms | Moose::Role::BEGIN@22 |
| 1 | 1 | 1 | 6µs | 23µs | Moose::Role::BEGIN@12 |
| 1 | 1 | 1 | 6µs | 94µs | Moose::Role::BEGIN@15 |
| 1 | 1 | 1 | 6µs | 25µs | Moose::Role::BEGIN@20 |
| 1 | 1 | 1 | 6µs | 16µs | Moose::Role::BEGIN@8 |
| 1 | 1 | 1 | 6µs | 9µs | Moose::Role::BEGIN@9 |
| 1 | 1 | 1 | 5µs | 22µs | Moose::Role::BEGIN@13 |
| 1 | 1 | 1 | 4µs | 4µs | Moose::Role::BEGIN@21 |
| 1 | 1 | 1 | 3µs | 3µs | Moose::Role::BEGIN@17 |
| 1 | 1 | 1 | 3µs | 3µs | Moose::Role::BEGIN@18 |
| 0 | 0 | 0 | 0s | 0s | Moose::Role::augment |
| 0 | 0 | 0 | 0s | 0s | Moose::Role::excludes |
| 0 | 0 | 0 | 0s | 0s | Moose::Role::extends |
| 0 | 0 | 0 | 0s | 0s | Moose::Role::inner |
| Line | State ments |
Time on line |
Calls | Time in subs |
Code |
|---|---|---|---|---|---|
| 1 | package Moose::Role; | ||||
| 2 | # spent 8µs within Moose::Role::BEGIN@2 which was called:
# once (8µs+0s) by MooseX::Storage::Meta::Attribute::Trait::DoNotSerialize::BEGIN@9 at line 4 | ||||
| 3 | 1 | 4µs | $Moose::Role::AUTHORITY = 'cpan:STEVAN'; | ||
| 4 | 1 | 28µs | 1 | 8µs | } # spent 8µs making 1 call to Moose::Role::BEGIN@2 |
| 5 | { | ||||
| 6 | 2 | 800ns | $Moose::Role::VERSION = '2.1005'; | ||
| 7 | } | ||||
| 8 | 2 | 20µs | 2 | 26µs | # spent 16µs (6+10) within Moose::Role::BEGIN@8 which was called:
# once (6µs+10µs) by MooseX::Storage::Meta::Attribute::Trait::DoNotSerialize::BEGIN@9 at line 8 # spent 16µs making 1 call to Moose::Role::BEGIN@8
# spent 10µs making 1 call to strict::import |
| 9 | 2 | 24µs | 2 | 12µs | # spent 9µs (6+3) within Moose::Role::BEGIN@9 which was called:
# once (6µs+3µs) by MooseX::Storage::Meta::Attribute::Trait::DoNotSerialize::BEGIN@9 at line 9 # spent 9µs making 1 call to Moose::Role::BEGIN@9
# spent 3µs making 1 call to warnings::import |
| 10 | |||||
| 11 | 2 | 22µs | 2 | 47µs | # spent 27µs (6+20) within Moose::Role::BEGIN@11 which was called:
# once (6µs+20µs) by MooseX::Storage::Meta::Attribute::Trait::DoNotSerialize::BEGIN@9 at line 11 # spent 27µs making 1 call to Moose::Role::BEGIN@11
# spent 20µs making 1 call to Exporter::import |
| 12 | 2 | 19µs | 2 | 40µs | # spent 23µs (6+17) within Moose::Role::BEGIN@12 which was called:
# once (6µs+17µs) by MooseX::Storage::Meta::Attribute::Trait::DoNotSerialize::BEGIN@9 at line 12 # spent 23µs making 1 call to Moose::Role::BEGIN@12
# spent 17µs making 1 call to Exporter::import |
| 13 | 2 | 18µs | 2 | 40µs | # spent 22µs (5+17) within Moose::Role::BEGIN@13 which was called:
# once (5µs+17µs) by MooseX::Storage::Meta::Attribute::Trait::DoNotSerialize::BEGIN@9 at line 13 # spent 22µs making 1 call to Moose::Role::BEGIN@13
# spent 17µs making 1 call to Exporter::import |
| 14 | |||||
| 15 | 2 | 21µs | 2 | 182µs | # spent 94µs (6+88) within Moose::Role::BEGIN@15 which was called:
# once (6µs+88µs) by MooseX::Storage::Meta::Attribute::Trait::DoNotSerialize::BEGIN@9 at line 15 # spent 94µs making 1 call to Moose::Role::BEGIN@15
# spent 88µs making 1 call to Sub::Exporter::__ANON__[Sub/Exporter.pm:337] |
| 16 | |||||
| 17 | 2 | 16µs | 1 | 3µs | # spent 3µs within Moose::Role::BEGIN@17 which was called:
# once (3µs+0s) by MooseX::Storage::Meta::Attribute::Trait::DoNotSerialize::BEGIN@9 at line 17 # spent 3µs making 1 call to Moose::Role::BEGIN@17 |
| 18 | 2 | 21µs | 1 | 3µs | # spent 3µs within Moose::Role::BEGIN@18 which was called:
# once (3µs+0s) by MooseX::Storage::Meta::Attribute::Trait::DoNotSerialize::BEGIN@9 at line 18 # spent 3µs making 1 call to Moose::Role::BEGIN@18 |
| 19 | |||||
| 20 | 2 | 18µs | 2 | 45µs | # spent 25µs (6+20) within Moose::Role::BEGIN@20 which was called:
# once (6µs+20µs) by MooseX::Storage::Meta::Attribute::Trait::DoNotSerialize::BEGIN@9 at line 20 # spent 25µs making 1 call to Moose::Role::BEGIN@20
# spent 20µs making 1 call to Moose::Exporter::import |
| 21 | 2 | 17µs | 1 | 4µs | # spent 4µs within Moose::Role::BEGIN@21 which was called:
# once (4µs+0s) by MooseX::Storage::Meta::Attribute::Trait::DoNotSerialize::BEGIN@9 at line 21 # spent 4µs making 1 call to Moose::Role::BEGIN@21 |
| 22 | 2 | 635µs | 2 | 2.21ms | # spent 1.11ms (6µs+1.10) within Moose::Role::BEGIN@22 which was called:
# once (6µs+1.10ms) by MooseX::Storage::Meta::Attribute::Trait::DoNotSerialize::BEGIN@9 at line 22 # spent 1.11ms making 1 call to Moose::Role::BEGIN@22
# spent 1.10ms making 1 call to Moose::Exporter::__ANON__[Moose/Exporter.pm:519] |
| 23 | |||||
| 24 | sub extends { | ||||
| 25 | croak "Roles do not support 'extends' (you can use 'with' to specialize a role)"; | ||||
| 26 | } | ||||
| 27 | |||||
| 28 | # spent 204ms (88µs+203) within Moose::Role::with which was called 22 times, avg 9.25ms/call:
# 11 times (28µs+82.7ms) by Moose::Role::with at line 409 of Moose/Exporter.pm, avg 7.52ms/call
# once (6µs+38.2ms) by Module::Runtime::require_module at line 14 of Moose/Meta/Method/Accessor/Native/Array/clear.pm
# once (5µs+27.9ms) by Module::Runtime::require_module at line 14 of Moose/Meta/Method/Accessor/Native/Array/Writer.pm
# once (7µs+10.2ms) by Module::Runtime::require_module at line 11 of Moose/Meta/Attribute/Native/Trait/Array.pm
# once (5µs+9.46ms) by Module::Runtime::require_module at line 14 of Moose/Meta/Method/Accessor/Native/Array/count.pm
# once (5µs+6.74ms) by Module::Runtime::require_module at line 14 of Moose/Meta/Method/Accessor/Native/Array/push.pm
# once (5µs+6.49ms) by Module::Runtime::require_module at line 14 of Moose/Meta/Method/Accessor/Native/Array/set.pm
# once (6µs+5.03ms) by Module::Runtime::require_module at line 17 of Moose/Meta/Method/Accessor/Native/Writer.pm
# once (5µs+5.02ms) by Module::Runtime::require_module at line 14 of Moose/Meta/Method/Accessor/Native/Reader.pm
# once (5µs+4.96ms) by Module::Runtime::require_module at line 14 of Moose/Meta/Method/Accessor/Native/Array/elements.pm
# once (6µs+3.65ms) by Module::Runtime::require_module at line 14 of Moose/Meta/Method/Accessor/Native/Array/delete.pm
# once (5µs+3.05ms) by Module::Runtime::require_module at line 16 of Moose/Meta/Method/Accessor/Native/Array/get.pm | ||||
| 29 | 11 | 25µs | 11 | 3.64ms | Moose::Util::apply_all_roles( shift, @_ ); # spent 121ms making 11 calls to Moose::Util::apply_all_roles, avg 11.0ms/call, recursion: max depth 3, sum of overlapping time 117ms |
| 30 | } | ||||
| 31 | |||||
| 32 | # spent 555µs (55+501) within Moose::Role::requires which was called 12 times, avg 46µs/call:
# 6 times (22µs+220µs) by Moose::Role::requires at line 409 of Moose/Exporter.pm, avg 40µs/call
# once (8µs+92µs) by Module::Runtime::require_module at line 12 of MooseX/Storage/IO/StorableFile.pm
# once (5µs+44µs) by Module::Runtime::require_module at line 19 of Moose/Meta/Method/Accessor/Native/Writer.pm
# once (5µs+42µs) by Module::Runtime::require_module at line 17 of Moose/Meta/Attribute/Native/Trait.pm
# once (5µs+37µs) by Module::Runtime::require_module at line 16 of Moose/Meta/Method/Accessor/Native/Reader.pm
# once (5µs+35µs) by Module::Runtime::require_module at line 14 of Moose/Meta/Method/Accessor/Native/Collection.pm
# once (4µs+30µs) by Module::Runtime::require_module at line 13 of MooseX/Storage/IO/StorableFile.pm | ||||
| 33 | 6 | 1µs | my $meta = shift; | ||
| 34 | 6 | 1µs | croak "Must specify at least one method" unless @_; | ||
| 35 | 6 | 15µs | 6 | 220µs | $meta->add_required_methods(@_); # spent 220µs making 6 calls to Moose::Meta::Role::add_required_methods, avg 37µs/call |
| 36 | } | ||||
| 37 | |||||
| 38 | sub excludes { | ||||
| 39 | my $meta = shift; | ||||
| 40 | croak "Must specify at least one role" unless @_; | ||||
| 41 | $meta->add_excluded_roles(@_); | ||||
| 42 | } | ||||
| 43 | |||||
| 44 | # spent 9.99ms (290µs+9.69) within Moose::Role::has which was called 38 times, avg 263µs/call:
# 19 times (205µs+4.69ms) by Moose::Role::has at line 409 of Moose/Exporter.pm, avg 258µs/call
# 3 times (13µs+208µs) by Module::Runtime::require_module at line 31 of lib/roles/PhysVecRole.pm, avg 74µs/call
# 3 times (12µs+200µs) by Module::Runtime::require_module at line 102 of lib/roles/PhysVecRole.pm, avg 71µs/call
# 2 times (8µs+138µs) by Module::Runtime::require_module at line 64 of lib/roles/PhysVecRole.pm, avg 73µs/call
# once (9µs+3.76ms) by Module::Runtime::require_module at line 6 of lib/roles/PhysVecRole.pm
# once (5µs+80µs) by Module::Runtime::require_module at line 19 of Moose/Meta/Attribute/Native/Trait.pm
# once (5µs+78µs) by Module::Runtime::require_module at line 223 of Moose/Meta/Attribute/Native/Trait.pm
# once (5µs+73µs) by Module::Runtime::require_module at line 8 of lib/roles/PhysVecRole.pm
# once (4µs+73µs) by Module::Runtime::require_module at line 56 of lib/roles/PhysVecRole.pm
# once (4µs+71µs) by Module::Runtime::require_module at line 10 of lib/roles/PhysVecRole.pm
# once (4µs+66µs) by Module::Runtime::require_module at line 47 of lib/roles/PhysVecRole.pm
# once (4µs+66µs) by Module::Runtime::require_module at line 12 of lib/roles/PhysVecRole.pm
# once (4µs+64µs) by Module::Runtime::require_module at line 170 of lib/roles/PhysVecRole.pm
# once (4µs+64µs) by Module::Runtime::require_module at line 34 of lib/roles/PhysVecRole.pm
# once (4µs+63µs) by Module::Runtime::require_module at line 40 of lib/roles/PhysVecRole.pm | ||||
| 45 | 19 | 2µs | my $meta = shift; | ||
| 46 | 19 | 2µs | my $name = shift; | ||
| 47 | 19 | 2µs | croak 'Usage: has \'name\' => ( key => value, ... )' if @_ == 1; | ||
| 48 | 19 | 25µs | 19 | 89µs | my %context = Moose::Util::_caller_info; # spent 89µs making 19 calls to Moose::Util::_caller_info, avg 5µs/call |
| 49 | 19 | 9µs | $context{context} = 'has declaration'; | ||
| 50 | 19 | 4µs | $context{type} = 'role'; | ||
| 51 | 19 | 25µs | my %options = ( definition_context => \%context, @_ ); | ||
| 52 | 19 | 12µs | my $attrs = ( ref($name) eq 'ARRAY' ) ? $name : [ ($name) ]; | ||
| 53 | 19 | 85µs | 19 | 4.60ms | $meta->add_attribute( $_, %options ) for @$attrs; # spent 4.60ms making 19 calls to Moose::Meta::Role::add_attribute, avg 242µs/call |
| 54 | } | ||||
| 55 | |||||
| 56 | # spent 219µs (28+190) within Moose::Role::_add_method_modifier which was called 9 times, avg 24µs/call:
# 6 times (18µs+122µs) by Moose::Role::around at line 72, avg 23µs/call
# 2 times (8µs+46µs) by Moose::Role::before at line 68, avg 27µs/call
# once (3µs+22µs) by Moose::Role::after at line 70 | ||||
| 57 | 9 | 2µs | my $type = shift; | ||
| 58 | 9 | 1µs | my $meta = shift; | ||
| 59 | |||||
| 60 | 9 | 2µs | if ( ref($_[0]) eq 'Regexp' ) { | ||
| 61 | croak "Roles do not currently support regex " | ||||
| 62 | . " references for $type method modifiers"; | ||||
| 63 | } | ||||
| 64 | |||||
| 65 | 9 | 22µs | 9 | 190µs | Moose::Util::add_method_modifier($meta, $type, \@_); # spent 190µs making 9 calls to Moose::Util::add_method_modifier, avg 21µs/call |
| 66 | } | ||||
| 67 | |||||
| 68 | 2 | 5µs | 2 | 54µs | # spent 141µs (17+124) within Moose::Role::before which was called 4 times, avg 35µs/call:
# 2 times (6µs+54µs) by Moose::Role::before at line 409 of Moose/Exporter.pm, avg 30µs/call
# once (7µs+45µs) by Module::Runtime::require_module at line 55 of Moose/Meta/Attribute/Native/Trait.pm
# once (4µs+25µs) by Module::Runtime::require_module at line 122 of Moose/Meta/Attribute/Native/Trait.pm # spent 54µs making 2 calls to Moose::Role::_add_method_modifier, avg 27µs/call |
| 69 | |||||
| 70 | 1 | 3µs | 1 | 25µs | # spent 68µs (10+58) within Moose::Role::after which was called 2 times, avg 34µs/call:
# once (7µs+33µs) by Module::Runtime::require_module at line 87 of Moose/Meta/Attribute/Native/Trait.pm
# once (3µs+25µs) by Moose::Role::after at line 409 of Moose/Exporter.pm # spent 25µs making 1 call to Moose::Role::_add_method_modifier |
| 71 | |||||
| 72 | 6 | 11µs | 6 | 140µs | # spent 3.68ms (3.35+326µs) within Moose::Role::around which was called 12 times, avg 307µs/call:
# 6 times (15µs+140µs) by Moose::Role::around at line 409 of Moose/Exporter.pm, avg 26µs/call
# once (3.31ms+31µs) by Module::Runtime::require_module at line 190 of Moose/Meta/Attribute/Native/Trait.pm
# once (6µs+40µs) by Module::Runtime::require_module at line 43 of Moose/Meta/Method/Accessor/Native.pm
# once (7µs+33µs) by Module::Runtime::require_module at line 155 of Moose/Meta/Attribute/Native/Trait.pm
# once (4µs+29µs) by Module::Runtime::require_module at line 166 of Moose/Meta/Method/Accessor/Native/Collection.pm
# once (4µs+27µs) by Module::Runtime::require_module at line 132 of Moose/Meta/Method/Accessor/Native/Writer.pm
# once (4µs+26µs) by Module::Runtime::require_module at line 142 of Moose/Meta/Method/Accessor/Native/Writer.pm # spent 140µs making 6 calls to Moose::Role::_add_method_modifier, avg 23µs/call |
| 73 | |||||
| 74 | # see Moose.pm for discussion | ||||
| 75 | # spent 2.73ms (112µs+2.62) within Moose::Role::super which was called 52 times, avg 53µs/call:
# 26 times (54µs+1.80ms) by Moose::Meta::Method::Accessor::Native::__ANON__[/Users/dde/perl5/perlbrew/perls/5.18.0t/lib/site_perl/5.18.0/darwin-thread-multi-2level/Moose/Meta/Method/Accessor/Native.pm:156] at line 139 of Moose/Meta/Method/Accessor/Native.pm, avg 71µs/call
# 26 times (58µs+820µs) by Moose::Meta::Method::Accessor::Native::__ANON__[/Users/dde/perl5/perlbrew/perls/5.18.0t/lib/site_perl/5.18.0/darwin-thread-multi-2level/Moose/Meta/Method/Accessor/Native.pm:125] at line 122 of Moose/Meta/Method/Accessor/Native.pm, avg 34µs/call | ||||
| 76 | 52 | 5µs | return unless $Moose::SUPER_BODY; | ||
| 77 | 52 | 98µs | 52 | 2.62ms | $Moose::SUPER_BODY->(@Moose::SUPER_ARGS); # spent 1.80ms making 26 calls to Moose::Meta::Method::Accessor::_eval_environment, avg 69µs/call
# spent 820µs making 26 calls to Moose::Meta::Method::Accessor::_get_value, avg 32µs/call |
| 78 | } | ||||
| 79 | |||||
| 80 | # spent 213µs (25+188) within Moose::Role::override which was called 6 times, avg 35µs/call:
# 3 times (10µs+81µs) by Moose::Role::override at line 409 of Moose/Exporter.pm, avg 30µs/call
# once (7µs+50µs) by Module::Runtime::require_module at line 125 of Moose/Meta/Method/Accessor/Native.pm
# once (4µs+30µs) by Module::Runtime::require_module at line 134 of Moose/Meta/Method/Accessor/Native.pm
# once (4µs+27µs) by Module::Runtime::require_module at line 156 of Moose/Meta/Method/Accessor/Native.pm | ||||
| 81 | 3 | 400ns | my $meta = shift; | ||
| 82 | 3 | 1µs | my ( $name, $code ) = @_; | ||
| 83 | 3 | 7µs | 3 | 81µs | $meta->add_override_method_modifier( $name, $code ); # spent 81µs making 3 calls to Moose::Meta::Role::add_override_method_modifier, avg 27µs/call |
| 84 | } | ||||
| 85 | |||||
| 86 | sub inner { | ||||
| 87 | croak "Roles cannot support 'inner'"; | ||||
| 88 | } | ||||
| 89 | |||||
| 90 | sub augment { | ||||
| 91 | croak "Roles cannot support 'augment'"; | ||||
| 92 | } | ||||
| 93 | |||||
| 94 | 1 | 5µs | 1 | 699µs | Moose::Exporter->setup_import_methods( # spent 699µs making 1 call to Moose::Exporter::setup_import_methods |
| 95 | with_meta => [ | ||||
| 96 | qw( with requires excludes has before after around override ) | ||||
| 97 | ], | ||||
| 98 | as_is => [ | ||||
| 99 | qw( extends super inner augment ), | ||||
| 100 | \&Carp::confess, | ||||
| 101 | \&Scalar::Util::blessed, | ||||
| 102 | ], | ||||
| 103 | ); | ||||
| 104 | |||||
| 105 | # spent 21.9ms (387µs+21.5) within Moose::Role::init_meta which was called 19 times, avg 1.15ms/call:
# 19 times (387µs+21.5ms) by Moose::Exporter::__ANON__[/Users/dde/perl5/perlbrew/perls/5.18.0t/lib/site_perl/5.18.0/darwin-thread-multi-2level/Moose/Exporter.pm:519] at line 474 of Moose/Exporter.pm, avg 1.15ms/call | ||||
| 106 | 19 | 900ns | shift; | ||
| 107 | 19 | 22µs | my %args = @_; | ||
| 108 | |||||
| 109 | 19 | 4µs | my $role = $args{for_class}; | ||
| 110 | |||||
| 111 | 19 | 200ns | unless ($role) { | ||
| 112 | require Moose; | ||||
| 113 | Moose->throw_error("Cannot call init_meta without specifying a for_class"); | ||||
| 114 | } | ||||
| 115 | |||||
| 116 | 19 | 5µs | my $metaclass = $args{metaclass} || "Moose::Meta::Role"; | ||
| 117 | 19 | 8µs | my $meta_name = exists $args{meta_name} ? $args{meta_name} : 'meta'; | ||
| 118 | |||||
| 119 | 19 | 68µs | 19 | 29µs | Moose->throw_error("The Metaclass $metaclass must be loaded. (Perhaps you forgot to 'use $metaclass'?)") # spent 29µs making 19 calls to Class::Load::XS::is_class_loaded, avg 2µs/call |
| 120 | unless is_class_loaded($metaclass); | ||||
| 121 | |||||
| 122 | 19 | 53µs | 19 | 17µs | Moose->throw_error("The Metaclass $metaclass must be a subclass of Moose::Meta::Role.") # spent 17µs making 19 calls to UNIVERSAL::isa, avg 889ns/call |
| 123 | unless $metaclass->isa('Moose::Meta::Role'); | ||||
| 124 | |||||
| 125 | # make a subtype for each Moose role | ||||
| 126 | 19 | 32µs | 38 | 10.1ms | role_type $role unless find_type_constraint($role); # spent 9.89ms making 19 calls to Moose::Util::TypeConstraints::role_type, avg 521µs/call
# spent 190µs making 19 calls to Moose::Util::TypeConstraints::find_type_constraint, avg 10µs/call |
| 127 | |||||
| 128 | 19 | 2µs | my $meta; | ||
| 129 | 19 | 22µs | 19 | 21µs | if ( $meta = Class::MOP::get_metaclass_by_name($role) ) { # spent 21µs making 19 calls to Class::MOP::get_metaclass_by_name, avg 1µs/call |
| 130 | unless ( $meta->isa("Moose::Meta::Role") ) { | ||||
| 131 | my $error_message = "$role already has a metaclass, but it does not inherit $metaclass ($meta)."; | ||||
| 132 | if ( $meta->isa('Moose::Meta::Class') ) { | ||||
| 133 | Moose->throw_error($error_message . ' You cannot make the same thing a role and a class. Remove either Moose or Moose::Role.'); | ||||
| 134 | } else { | ||||
| 135 | Moose->throw_error($error_message); | ||||
| 136 | } | ||||
| 137 | } | ||||
| 138 | } | ||||
| 139 | else { | ||||
| 140 | 19 | 26µs | 19 | 1.59ms | $meta = $metaclass->initialize($role); # spent 1.59ms making 19 calls to Moose::Meta::Role::initialize, avg 83µs/call |
| 141 | } | ||||
| 142 | |||||
| 143 | 19 | 9µs | if (defined $meta_name) { | ||
| 144 | # also check for inherited non moose 'meta' method? | ||||
| 145 | 19 | 21µs | 19 | 660µs | my $existing = $meta->get_method($meta_name); # spent 660µs making 19 calls to Class::MOP::Mixin::HasMethods::get_method, avg 35µs/call |
| 146 | 19 | 200ns | if ($existing && !$existing->isa('Class::MOP::Method::Meta')) { | ||
| 147 | Carp::cluck "Moose::Role is overwriting an existing method named " | ||||
| 148 | . "$meta_name in role $role with a method " | ||||
| 149 | . "which returns the class's metaclass. If this is " | ||||
| 150 | . "actually what you want, you should remove the " | ||||
| 151 | . "existing method, otherwise, you should rename or " | ||||
| 152 | . "disable this generated method using the " | ||||
| 153 | . "'-meta_name' option to 'use Moose::Role'."; | ||||
| 154 | } | ||||
| 155 | 19 | 23µs | 19 | 9.13ms | $meta->_add_meta_method($meta_name); # spent 9.13ms making 19 calls to Class::MOP::Mixin::HasMethods::_add_meta_method, avg 480µs/call |
| 156 | } | ||||
| 157 | |||||
| 158 | 19 | 43µs | return $meta; | ||
| 159 | } | ||||
| 160 | |||||
| 161 | 1 | 5µs | 1; | ||
| 162 | |||||
| 163 | # ABSTRACT: The Moose Role | ||||
| 164 | |||||
| 165 | __END__ |