| Filename | /home/doy/coding/src/Moose/blib/lib//Moose/Role.pm |
| Statements | Executed 781 statements in 11.6ms |
| Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
|---|---|---|---|---|---|
| 35 | 1 | 1 | 5.63ms | 159ms | Moose::Role::init_meta |
| 30 | 16 | 16 | 1.08ms | 23.9ms | Moose::Role::requires |
| 36 | 19 | 19 | 1.07ms | 1.38s | Moose::Role::with (recurses: max depth 2, inclusive time 194ms) |
| 14 | 8 | 5 | 793µs | 9.06ms | Moose::Role::has |
| 12 | 7 | 5 | 343µs | 3.18ms | Moose::Role::around |
| 9 | 3 | 1 | 248µs | 1.82ms | Moose::Role::_add_method_modifier |
| 10 | 2 | 1 | 217µs | 1.80ms | Moose::Role::super |
| 6 | 4 | 2 | 180µs | 1.83ms | Moose::Role::override |
| 4 | 3 | 2 | 117µs | 1.07ms | Moose::Role::before |
| 1 | 1 | 1 | 75µs | 94µs | Moose::Role::BEGIN@2 |
| 2 | 2 | 2 | 63µs | 537µs | Moose::Role::after |
| 1 | 1 | 1 | 39µs | 8.13ms | Moose::Role::BEGIN@19 |
| 1 | 1 | 1 | 38µs | 106µs | Moose::Role::BEGIN@3 |
| 1 | 1 | 1 | 38µs | 672µs | Moose::Role::BEGIN@8 |
| 1 | 1 | 1 | 37µs | 193µs | Moose::Role::BEGIN@5 |
| 1 | 1 | 1 | 36µs | 175µs | Moose::Role::BEGIN@17 |
| 1 | 1 | 1 | 35µs | 158µs | Moose::Role::BEGIN@6 |
| 1 | 1 | 1 | 25µs | 25µs | Moose::Role::BEGIN@18 |
| 1 | 1 | 1 | 23µs | 23µs | Moose::Role::BEGIN@14 |
| 1 | 1 | 1 | 18µs | 18µs | Moose::Role::BEGIN@15 |
| 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 | 3 | 97µs | 2 | 112µs | # spent 94µs (75+18) within Moose::Role::BEGIN@2 which was called:
# once (75µs+18µs) by KiokuDB::Backend::BEGIN@4 at line 2 # spent 94µs making 1 call to Moose::Role::BEGIN@2
# spent 18µs making 1 call to strict::import |
| 3 | 3 | 114µs | 2 | 175µs | # spent 106µs (38+68) within Moose::Role::BEGIN@3 which was called:
# once (38µs+68µs) by KiokuDB::Backend::BEGIN@4 at line 3 # spent 106µs making 1 call to Moose::Role::BEGIN@3
# spent 68µs making 1 call to warnings::import |
| 4 | |||||
| 5 | 3 | 115µs | 2 | 349µs | # spent 193µs (37+156) within Moose::Role::BEGIN@5 which was called:
# once (37µs+156µs) by KiokuDB::Backend::BEGIN@4 at line 5 # spent 193µs making 1 call to Moose::Role::BEGIN@5
# spent 156µs making 1 call to Exporter::import |
| 6 | 3 | 92µs | 2 | 282µs | # spent 158µs (35+123) within Moose::Role::BEGIN@6 which was called:
# once (35µs+123µs) by KiokuDB::Backend::BEGIN@4 at line 6 # spent 158µs making 1 call to Moose::Role::BEGIN@6
# spent 123µs making 1 call to Exporter::import |
| 7 | |||||
| 8 | 3 | 246µs | 2 | 1.31ms | # spent 672µs (38+634) within Moose::Role::BEGIN@8 which was called:
# once (38µs+634µs) by KiokuDB::Backend::BEGIN@4 at line 8 # spent 672µs making 1 call to Moose::Role::BEGIN@8
# spent 634µs making 1 call to Sub::Exporter::__ANON__[Sub/Exporter.pm:756] |
| 9 | |||||
| 10 | 1 | 4µs | our $VERSION = '1.19'; | ||
| 11 | 1 | 61µs | $VERSION = eval $VERSION; # spent 11µs executing statements in string eval | ||
| 12 | 1 | 3µs | our $AUTHORITY = 'cpan:STEVAN'; | ||
| 13 | |||||
| 14 | 3 | 79µs | 1 | 23µs | # spent 23µs within Moose::Role::BEGIN@14 which was called:
# once (23µs+0s) by KiokuDB::Backend::BEGIN@4 at line 14 # spent 23µs making 1 call to Moose::Role::BEGIN@14 |
| 15 | 3 | 80µs | 1 | 18µs | # spent 18µs within Moose::Role::BEGIN@15 which was called:
# once (18µs+0s) by KiokuDB::Backend::BEGIN@4 at line 15 # spent 18µs making 1 call to Moose::Role::BEGIN@15 |
| 16 | |||||
| 17 | 3 | 122µs | 2 | 314µs | # spent 175µs (36+139) within Moose::Role::BEGIN@17 which was called:
# once (36µs+139µs) by KiokuDB::Backend::BEGIN@4 at line 17 # spent 175µs making 1 call to Moose::Role::BEGIN@17
# spent 139µs making 1 call to Moose::Exporter::import |
| 18 | 3 | 88µs | 1 | 25µs | # spent 25µs within Moose::Role::BEGIN@18 which was called:
# once (25µs+0s) by KiokuDB::Backend::BEGIN@4 at line 18 # spent 25µs making 1 call to Moose::Role::BEGIN@18 |
| 19 | 3 | 2.53ms | 2 | 16.2ms | # spent 8.13ms (39µs+8.09) within Moose::Role::BEGIN@19 which was called:
# once (39µs+8.09ms) by KiokuDB::Backend::BEGIN@4 at line 19 # spent 8.13ms making 1 call to Moose::Role::BEGIN@19
# spent 8.09ms making 1 call to Moose::Exporter::__ANON__[Moose/Exporter.pm:456] |
| 20 | |||||
| 21 | sub extends { | ||||
| 22 | croak "Roles do not support 'extends' (you can use 'with' to specialize a role)"; | ||||
| 23 | } | ||||
| 24 | |||||
| 25 | # spent 1.38s (1.07ms+1.38) within Moose::Role::with which was called 36 times, avg 38.4ms/call:
# 18 times (372µs+593ms) by Moose::Role::with at line 359 of Moose/Exporter.pm, avg 33.0ms/call
# once (37µs+193ms) by Class::MOP::__ANON__[/home/doy/coding/src/Class-MOP/blib/lib//Class/MOP.pm:118] at line 12 of Moose/Meta/Method/Accessor/Native/Array/push.pm
# once (42µs+140ms) by Class::MOP::__ANON__[/home/doy/coding/src/Class-MOP/blib/lib//Class/MOP.pm:118] at line 12 of Moose/Meta/Method/Accessor/Native/Array/Writer.pm
# once (35µs+102ms) by Class::MOP::__ANON__[/home/doy/coding/src/Class-MOP/blib/lib//Class/MOP.pm:118] at line 10 of KiokuDB/TypeMap/Entry/Std.pm
# once (39µs+74.3ms) by Class::MOP::__ANON__[/home/doy/coding/src/Class-MOP/blib/lib//Class/MOP.pm:118] at line 14 of Moose/Meta/Method/Accessor/Native/Hash/values.pm
# once (38µs+46.0ms) by Class::MOP::__ANON__[/home/doy/coding/src/Class-MOP/blib/lib//Class/MOP.pm:118] at line 9 of Moose/Meta/Attribute/Native/Trait/Hash.pm
# once (38µs+40.4ms) by Class::MOP::__ANON__[/home/doy/coding/src/Class-MOP/blib/lib//Class/MOP.pm:118] at line 12 of Moose/Meta/Method/Accessor/Native/Reader.pm
# once (34µs+29.8ms) by MooseX::Clone::BEGIN@11 at line 10 of MooseX/Clone/Meta/Attribute/Trait/StorableClone.pm
# once (39µs+29.0ms) by Class::MOP::__ANON__[/home/doy/coding/src/Class-MOP/blib/lib//Class/MOP.pm:118] at line 12 of Moose/Meta/Method/Accessor/Native/Array/clear.pm
# once (44µs+28.5ms) by Class::MOP::__ANON__[/home/doy/coding/src/Class-MOP/blib/lib//Class/MOP.pm:118] at line 17 of KiokuDB/Role/UUIDs.pm
# once (42µs+26.4ms) by MooseX::Clone::BEGIN@10 at line 10 of MooseX/Clone/Meta/Attribute/Trait/Clone.pm
# once (36µs+22.6ms) by Class::MOP::__ANON__[/home/doy/coding/src/Class-MOP/blib/lib//Class/MOP.pm:118] at line 6 of KiokuDB/Error.pm
# once (39µs+13.9ms) by Class::MOP::__ANON__[/home/doy/coding/src/Class-MOP/blib/lib//Class/MOP.pm:118] at line 12 of Moose/Meta/Method/Accessor/Native/Array/elements.pm
# once (38µs+13.8ms) by Class::MOP::__ANON__[/home/doy/coding/src/Class-MOP/blib/lib//Class/MOP.pm:118] at line 14 of Moose/Meta/Method/Accessor/Native/Hash/keys.pm
# once (50µs+11.4ms) by Class::MOP::__ANON__[/home/doy/coding/src/Class-MOP/blib/lib//Class/MOP.pm:118] at line 14 of Moose/Meta/Method/Accessor/Native/Writer.pm
# once (39µs+8.83ms) by Class::MOP::__ANON__[/home/doy/coding/src/Class-MOP/blib/lib//Class/MOP.pm:118] at line 9 of Moose/Meta/Attribute/Native/Trait/Array.pm
# once (38µs+2.95ms) by Class::MOP::__ANON__[/home/doy/coding/src/Class-MOP/blib/lib//Class/MOP.pm:118] at line 6 of MooseX/Clone/Meta/Attribute/Trait/Clone/Std.pm
# once (33µs+2.89ms) by MooseX::Clone::BEGIN@12 at line 8 of MooseX/Clone/Meta/Attribute/Trait/NoClone.pm
# once (34µs+2.84ms) by MooseX::Clone::BEGIN@13 at line 10 of MooseX/Clone/Meta/Attribute/Trait/Copy.pm | ||||
| 26 | 18 | 378µs | 18 | 378ms | Moose::Util::apply_all_roles( shift, @_ ); # spent 787ms making 18 calls to Moose::Util::apply_all_roles, avg 43.7ms/call, recursion: max depth 2, sum of overlapping time 409ms |
| 27 | } | ||||
| 28 | |||||
| 29 | # spent 23.9ms (1.08+22.8) within Moose::Role::requires which was called 30 times, avg 798µs/call:
# 15 times (474µs+10.7ms) by Moose::Role::requires at line 359 of Moose/Exporter.pm, avg 747µs/call
# once (36µs+5.10ms) by Class::MOP::__ANON__[/home/doy/coding/src/Class-MOP/blib/lib//Class/MOP.pm:118] at line 6 of KiokuDB/Role/API.pm
# once (45µs+1.05ms) by KiokuDB::BEGIN@10 at line 26 of KiokuDB/Backend.pm
# once (34µs+827µs) by Class::MOP::__ANON__[/home/doy/coding/src/Class-MOP/blib/lib//Class/MOP.pm:118] at line 8 of KiokuDB/TypeMap/Entry/Std/Compile.pm
# once (36µs+661µs) by Class::MOP::__ANON__[/home/doy/coding/src/Class-MOP/blib/lib//Class/MOP.pm:118] at line 8 of KiokuDB/TypeMap/Entry/Std/Expand.pm
# once (97µs+466µs) by KiokuDB::TypeMap::BEGIN@9 at line 8 of KiokuDB/TypeMap/Entry.pm
# once (36µs+510µs) by Class::MOP::__ANON__[/home/doy/coding/src/Class-MOP/blib/lib//Class/MOP.pm:118] at line 8 of KiokuDB/Error.pm
# once (34µs+504µs) by Class::MOP::__ANON__[/home/doy/coding/src/Class-MOP/blib/lib//Class/MOP.pm:118] at line 16 of Moose/Meta/Method/Accessor/Native/Writer.pm
# once (37µs+485µs) by Class::MOP::__ANON__[/home/doy/coding/src/Class-MOP/blib/lib//Class/MOP.pm:118] at line 13 of Moose/Meta/Attribute/Native/Trait.pm
# once (33µs+484µs) by Class::MOP::__ANON__[/home/doy/coding/src/Class-MOP/blib/lib//Class/MOP.pm:118] at line 14 of Data/Stream/Bulk.pm
# once (50µs+425µs) by Class::MOP::__ANON__[/home/doy/coding/src/Class-MOP/blib/lib//Class/MOP.pm:118] at line 8 of MooseX/Clone/Meta/Attribute/Trait/Clone/Std.pm
# once (36µs+355µs) by Class::MOP::__ANON__[/home/doy/coding/src/Class-MOP/blib/lib//Class/MOP.pm:118] at line 12 of Moose/Meta/Method/Accessor/Native/Collection.pm
# once (35µs+332µs) by Class::MOP::__ANON__[/home/doy/coding/src/Class-MOP/blib/lib//Class/MOP.pm:118] at line 14 of Moose/Meta/Method/Accessor/Native/Reader.pm
# once (33µs+314µs) by Class::MOP::__ANON__[/home/doy/coding/src/Class-MOP/blib/lib//Class/MOP.pm:118] at line 8 of KiokuDB/Role/TypeMap.pm
# once (34µs+312µs) by Class::MOP::__ANON__[/home/doy/coding/src/Class-MOP/blib/lib//Class/MOP.pm:118] at line 8 of KiokuDB/TypeMap/Entry/Std/Intrinsic.pm
# once (33µs+305µs) by Class::MOP::__ANON__[/home/doy/coding/src/Class-MOP/blib/lib//Class/MOP.pm:118] at line 8 of MooseX/Clone/Meta/Attribute/Trait/Clone/Base.pm | ||||
| 30 | 15 | 50µs | my $meta = shift; | ||
| 31 | 15 | 33µs | croak "Must specify at least one method" unless @_; | ||
| 32 | 15 | 361µs | 15 | 10.7ms | $meta->add_required_methods(@_); # spent 10.7ms making 15 calls to Moose::Meta::Role::add_required_methods, avg 715µs/call |
| 33 | } | ||||
| 34 | |||||
| 35 | sub excludes { | ||||
| 36 | my $meta = shift; | ||||
| 37 | croak "Must specify at least one role" unless @_; | ||||
| 38 | $meta->add_excluded_roles(@_); | ||||
| 39 | } | ||||
| 40 | |||||
| 41 | # spent 9.06ms (793µs+8.27) within Moose::Role::has which was called 14 times, avg 647µs/call:
# 7 times (534µs+3.69ms) by Moose::Role::has at line 359 of Moose/Exporter.pm, avg 604µs/call
# once (47µs+863µs) by MooseX::Clone::BEGIN@10 at line 14 of MooseX/Clone/Meta/Attribute/Trait/Clone.pm
# once (37µs+661µs) by Class::MOP::__ANON__[/home/doy/coding/src/Class-MOP/blib/lib//Class/MOP.pm:118] at line 15 of Moose/Meta/Attribute/Native/Trait.pm
# once (38µs+648µs) by Class::MOP::__ANON__[/home/doy/coding/src/Class-MOP/blib/lib//Class/MOP.pm:118] at line 10 of KiokuDB/TypeMap/Entry/Std/Intrinsic.pm
# once (38µs+647µs) by Class::MOP::__ANON__[/home/doy/coding/src/Class-MOP/blib/lib//Class/MOP.pm:118] at line 16 of Throwable.pm
# once (35µs+637µs) by Class::MOP::__ANON__[/home/doy/coding/src/Class-MOP/blib/lib//Class/MOP.pm:118] at line 191 of Moose/Meta/Attribute/Native/Trait.pm
# once (33µs+568µs) by MooseX::Clone::BEGIN@10 at line 30 of MooseX/Clone/Meta/Attribute/Trait/Clone.pm
# once (33µs+550µs) by MooseX::Clone::BEGIN@10 at line 20 of MooseX/Clone/Meta/Attribute/Trait/Clone.pm | ||||
| 42 | 7 | 20µs | my $meta = shift; | ||
| 43 | 7 | 20µs | my $name = shift; | ||
| 44 | 7 | 18µs | croak 'Usage: has \'name\' => ( key => value, ... )' if @_ == 1; | ||
| 45 | 7 | 131µs | 7 | 286µs | my %options = ( definition_context => Moose::Util::_caller_info(), @_ ); # spent 286µs making 7 calls to Moose::Util::_caller_info, avg 41µs/call |
| 46 | 7 | 42µs | my $attrs = ( ref($name) eq 'ARRAY' ) ? $name : [ ($name) ]; | ||
| 47 | 14 | 282µs | 7 | 3.41ms | $meta->add_attribute( $_, %options ) for @$attrs; # spent 3.41ms making 7 calls to Moose::Meta::Role::add_attribute, avg 487µs/call |
| 48 | } | ||||
| 49 | |||||
| 50 | # spent 1.82ms (248µs+1.58) within Moose::Role::_add_method_modifier which was called 9 times, avg 203µs/call:
# 6 times (168µs+1.04ms) by Moose::Role::around at line 66, avg 202µs/call
# 2 times (56µs+352µs) by Moose::Role::before at line 62, avg 204µs/call
# once (24µs+179µs) by Moose::Role::after at line 64 | ||||
| 51 | 9 | 28µs | my $type = shift; | ||
| 52 | 9 | 21µs | my $meta = shift; | ||
| 53 | |||||
| 54 | 9 | 25µs | if ( ref($_[0]) eq 'Regexp' ) { | ||
| 55 | croak "Roles do not currently support regex " | ||||
| 56 | . " references for $type method modifiers"; | ||||
| 57 | } | ||||
| 58 | |||||
| 59 | 9 | 180µs | 9 | 1.58ms | Moose::Util::add_method_modifier($meta, $type, \@_); # spent 1.58ms making 9 calls to Moose::Util::add_method_modifier, avg 175µs/call |
| 60 | } | ||||
| 61 | |||||
| 62 | 2 | 42µs | 2 | 408µs | # spent 1.07ms (117µs+950µs) within Moose::Role::before which was called 4 times, avg 267µs/call:
# 2 times (39µs+408µs) by Moose::Role::before at line 359 of Moose/Exporter.pm, avg 224µs/call
# once (48µs+307µs) by Class::MOP::__ANON__[/home/doy/coding/src/Class-MOP/blib/lib//Class/MOP.pm:118] at line 51 of Moose/Meta/Attribute/Native/Trait.pm
# once (29µs+235µs) by Class::MOP::__ANON__[/home/doy/coding/src/Class-MOP/blib/lib//Class/MOP.pm:118] at line 101 of Moose/Meta/Attribute/Native/Trait.pm # spent 408µs making 2 calls to Moose::Role::_add_method_modifier, avg 204µs/call |
| 63 | |||||
| 64 | 1 | 20µs | 1 | 203µs | # spent 537µs (63+474) within Moose::Role::after which was called 2 times, avg 269µs/call:
# once (42µs+271µs) by Class::MOP::__ANON__[/home/doy/coding/src/Class-MOP/blib/lib//Class/MOP.pm:118] at line 83 of Moose/Meta/Attribute/Native/Trait.pm
# once (21µs+203µs) by Moose::Role::after at line 359 of Moose/Exporter.pm # spent 203µs making 1 call to Moose::Role::_add_method_modifier |
| 65 | |||||
| 66 | 6 | 119µs | 6 | 1.21ms | # spent 3.18ms (343µs+2.83) within Moose::Role::around which was called 12 times, avg 265µs/call:
# 6 times (111µs+1.21ms) by Moose::Role::around at line 359 of Moose/Exporter.pm, avg 221µs/call
# once (36µs+313µs) by Class::MOP::__ANON__[/home/doy/coding/src/Class-MOP/blib/lib//Class/MOP.pm:118] at line 32 of Moose/Meta/Method/Accessor/Native.pm
# once (64µs+261µs) by Class::MOP::__ANON__[/home/doy/coding/src/Class-MOP/blib/lib//Class/MOP.pm:118] at line 136 of Moose/Meta/Attribute/Native/Trait.pm
# once (37µs+286µs) by Class::MOP::__ANON__[/home/doy/coding/src/Class-MOP/blib/lib//Class/MOP.pm:118] at line 121 of Moose/Meta/Method/Accessor/Native/Writer.pm
# once (33µs+273µs) by Class::MOP::__ANON__[/home/doy/coding/src/Class-MOP/blib/lib//Class/MOP.pm:118] at line 147 of Moose/Meta/Method/Accessor/Native/Collection.pm
# once (31µs+247µs) by Class::MOP::__ANON__[/home/doy/coding/src/Class-MOP/blib/lib//Class/MOP.pm:118] at line 143 of Moose/Meta/Method/Accessor/Native/Writer.pm
# once (31µs+243µs) by Class::MOP::__ANON__[/home/doy/coding/src/Class-MOP/blib/lib//Class/MOP.pm:118] at line 158 of Moose/Meta/Attribute/Native/Trait.pm # spent 1.21ms making 6 calls to Moose::Role::_add_method_modifier, avg 202µs/call |
| 67 | |||||
| 68 | # see Moose.pm for discussion | ||||
| 69 | # spent 1.80ms (217µs+1.58) within Moose::Role::super which was called 10 times, avg 180µs/call:
# 5 times (109µs+904µs) by Moose::Meta::Method::Accessor::Native::__ANON__[/home/doy/coding/src/Moose/blib/lib//Moose/Meta/Method/Accessor/Native.pm:114] at line 111 of Moose/Meta/Method/Accessor/Native.pm, avg 203µs/call
# 5 times (109µs+677µs) by Moose::Meta::Method::Accessor::Native::__ANON__[/home/doy/coding/src/Moose/blib/lib//Moose/Meta/Method/Accessor/Native.pm:145] at line 128 of Moose/Meta/Method/Accessor/Native.pm, avg 157µs/call | ||||
| 70 | 10 | 23µs | return unless $Moose::SUPER_BODY; | ||
| 71 | 10 | 184µs | 10 | 1.58ms | $Moose::SUPER_BODY->(@Moose::SUPER_ARGS); # spent 904µs making 5 calls to Moose::Meta::Method::Accessor::_get_value, avg 181µs/call
# spent 677µs making 5 calls to Moose::Meta::Method::Accessor::_eval_environment, avg 135µs/call |
| 72 | } | ||||
| 73 | |||||
| 74 | # spent 1.83ms (180µs+1.65) within Moose::Role::override which was called 6 times, avg 305µs/call:
# 3 times (79µs+681µs) by Moose::Role::override at line 359 of Moose/Exporter.pm, avg 253µs/call
# once (42µs+401µs) by Class::MOP::__ANON__[/home/doy/coding/src/Class-MOP/blib/lib//Class/MOP.pm:118] at line 114 of Moose/Meta/Method/Accessor/Native.pm
# once (30µs+327µs) by Class::MOP::__ANON__[/home/doy/coding/src/Class-MOP/blib/lib//Class/MOP.pm:118] at line 123 of Moose/Meta/Method/Accessor/Native.pm
# once (29µs+242µs) by Class::MOP::__ANON__[/home/doy/coding/src/Class-MOP/blib/lib//Class/MOP.pm:118] at line 145 of Moose/Meta/Method/Accessor/Native.pm | ||||
| 75 | 3 | 8µs | my $meta = shift; | ||
| 76 | 3 | 12µs | my ( $name, $code ) = @_; | ||
| 77 | 3 | 55µs | 3 | 681µs | $meta->add_override_method_modifier( $name, $code ); # spent 681µs making 3 calls to Moose::Meta::Role::add_override_method_modifier, avg 227µs/call |
| 78 | } | ||||
| 79 | |||||
| 80 | sub inner { | ||||
| 81 | croak "Roles cannot support 'inner'"; | ||||
| 82 | } | ||||
| 83 | |||||
| 84 | sub augment { | ||||
| 85 | croak "Roles cannot support 'augment'"; | ||||
| 86 | } | ||||
| 87 | |||||
| 88 | 1 | 33µs | 1 | 4.67ms | Moose::Exporter->setup_import_methods( # spent 4.67ms making 1 call to Moose::Exporter::setup_import_methods |
| 89 | with_meta => [ | ||||
| 90 | qw( with requires excludes has before after around override ) | ||||
| 91 | ], | ||||
| 92 | as_is => [ | ||||
| 93 | qw( extends super inner augment ), | ||||
| 94 | \&Carp::confess, | ||||
| 95 | \&Scalar::Util::blessed, | ||||
| 96 | ], | ||||
| 97 | ); | ||||
| 98 | |||||
| 99 | # spent 159ms (5.63+153) within Moose::Role::init_meta which was called 35 times, avg 4.53ms/call:
# 35 times (5.63ms+153ms) by Moose::Exporter::__ANON__[/home/doy/coding/src/Moose/blib/lib//Moose/Exporter.pm:456] at line 423 of Moose/Exporter.pm, avg 4.53ms/call | ||||
| 100 | 35 | 86µs | shift; | ||
| 101 | 35 | 382µs | my %args = @_; | ||
| 102 | |||||
| 103 | 35 | 152µs | my $role = $args{for_class}; | ||
| 104 | |||||
| 105 | 35 | 67µs | unless ($role) { | ||
| 106 | require Moose; | ||||
| 107 | Moose->throw_error("Cannot call init_meta without specifying a for_class"); | ||||
| 108 | } | ||||
| 109 | |||||
| 110 | 35 | 138µs | my $metaclass = $args{metaclass} || "Moose::Meta::Role"; | ||
| 111 | 35 | 141µs | my $meta_name = exists $args{meta_name} ? $args{meta_name} : 'meta'; | ||
| 112 | |||||
| 113 | 35 | 1.00ms | 35 | 377µs | Moose->throw_error("The Metaclass $metaclass must be a subclass of Moose::Meta::Role.") # spent 377µs making 35 calls to UNIVERSAL::isa, avg 11µs/call |
| 114 | unless $metaclass->isa('Moose::Meta::Role'); | ||||
| 115 | |||||
| 116 | # make a subtype for each Moose role | ||||
| 117 | 35 | 798µs | 70 | 33.3ms | role_type $role unless find_type_constraint($role); # spent 29.8ms making 35 calls to Moose::Util::TypeConstraints::role_type, avg 853µs/call
# spent 3.48ms making 35 calls to Moose::Util::TypeConstraints::find_type_constraint, avg 99µs/call |
| 118 | |||||
| 119 | 35 | 75µs | my $meta; | ||
| 120 | 35 | 556µs | 35 | 451µs | if ( $meta = Class::MOP::get_metaclass_by_name($role) ) { # spent 451µs making 35 calls to Class::MOP::get_metaclass_by_name, avg 13µs/call |
| 121 | unless ( $meta->isa("Moose::Meta::Role") ) { | ||||
| 122 | my $error_message = "$role already has a metaclass, but it does not inherit $metaclass ($meta)."; | ||||
| 123 | if ( $meta->isa('Moose::Meta::Class') ) { | ||||
| 124 | Moose->throw_error($error_message . ' You cannot make the same thing a role and a class. Remove either Moose or Moose::Role.'); | ||||
| 125 | } else { | ||||
| 126 | Moose->throw_error($error_message); | ||||
| 127 | } | ||||
| 128 | } | ||||
| 129 | } | ||||
| 130 | else { | ||||
| 131 | 35 | 514µs | 35 | 25.5ms | $meta = $metaclass->initialize($role); # spent 25.5ms making 35 calls to Moose::Meta::Role::initialize, avg 728µs/call |
| 132 | } | ||||
| 133 | |||||
| 134 | 35 | 253µs | if (defined $meta_name) { | ||
| 135 | # also check for inherited non moose 'meta' method? | ||||
| 136 | 35 | 512µs | 35 | 8.02ms | my $existing = $meta->get_method($meta_name); # spent 8.02ms making 35 calls to Class::MOP::Mixin::HasMethods::get_method, avg 229µs/call |
| 137 | 35 | 71µs | if ($existing && !$existing->isa('Class::MOP::Method::Meta')) { | ||
| 138 | Carp::cluck "Moose::Role is overwriting an existing method named " | ||||
| 139 | . "$meta_name in role $role with a method " | ||||
| 140 | . "which returns the class's metaclass. If this is " | ||||
| 141 | . "actually what you want, you should remove the " | ||||
| 142 | . "existing method, otherwise, you should rename or " | ||||
| 143 | . "disable this generated method using the " | ||||
| 144 | . "'-meta_name' option to 'use Moose::Role'."; | ||||
| 145 | } | ||||
| 146 | 35 | 482µs | 35 | 85.4ms | $meta->_add_meta_method($meta_name); # spent 85.4ms making 35 calls to Class::MOP::Mixin::HasMethods::_add_meta_method, avg 2.44ms/call |
| 147 | } | ||||
| 148 | |||||
| 149 | 35 | 634µs | return $meta; | ||
| 150 | } | ||||
| 151 | |||||
| 152 | 1 | 31µs | 1; | ||
| 153 | |||||
| 154 | __END__ |