← Index
NYTProf Performance Profile   « block view • line view • sub view »
For -e
  Run on Wed Nov 17 22:00:36 2010
Reported on Wed Nov 17 22:13:48 2010

Filename/home/doy/coding/src/Moose/blib/lib//Moose/Role.pm
StatementsExecuted 921 statements in 13.1ms
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
40226.39ms191msMoose::Role::::init_metaMoose::Role::init_meta
5227271.60ms1.96sMoose::Role::::withMoose::Role::with (recurses: max depth 2, inclusive time 309ms)
181071.12ms12.2msMoose::Role::::hasMoose::Role::has
181010656µs7.12msMoose::Role::::requiresMoose::Role::requires
2821603µs6.85msMoose::Role::::superMoose::Role::super
1697434µs4.31msMoose::Role::::aroundMoose::Role::around
1331365µs2.73msMoose::Role::::_add_method_modifierMoose::Role::_add_method_modifier
642184µs1.76msMoose::Role::::overrideMoose::Role::override
643179µs1.79msMoose::Role::::beforeMoose::Role::before
433147µs1.12msMoose::Role::::afterMoose::Role::after
11195µs267µsMoose::Role::::BEGIN@5Moose::Role::BEGIN@5
11163µs78µsMoose::Role::::BEGIN@2Moose::Role::BEGIN@2
11154µs194µsMoose::Role::::BEGIN@6Moose::Role::BEGIN@6
11148µs110µsMoose::Role::::BEGIN@3Moose::Role::BEGIN@3
11139µs8.07msMoose::Role::::BEGIN@19Moose::Role::BEGIN@19
11137µs692µsMoose::Role::::BEGIN@8Moose::Role::BEGIN@8
11135µs169µsMoose::Role::::BEGIN@17Moose::Role::BEGIN@17
11126µs26µsMoose::Role::::BEGIN@18Moose::Role::BEGIN@18
11124µs24µsMoose::Role::::BEGIN@14Moose::Role::BEGIN@14
11119µs19µsMoose::Role::::BEGIN@15Moose::Role::BEGIN@15
0000s0sMoose::Role::::augmentMoose::Role::augment
0000s0sMoose::Role::::excludesMoose::Role::excludes
0000s0sMoose::Role::::extendsMoose::Role::extends
0000s0sMoose::Role::::innerMoose::Role::inner
Call graph for these subroutines as a Graphviz dot language file.
Line State
ments
Time
on line
Calls Time
in subs
Code
1package Moose::Role;
23105µs294µs
# spent 78µs (63+16) within Moose::Role::BEGIN@2 which was called: # once (63µs+16µs) by MooseX::SemiAffordanceAccessor::Role::Attribute::BEGIN@9 at line 2
use strict;
# spent 78µs making 1 call to Moose::Role::BEGIN@2 # spent 16µs making 1 call to strict::import
33104µs2172µs
# spent 110µs (48+62) within Moose::Role::BEGIN@3 which was called: # once (48µs+62µs) by MooseX::SemiAffordanceAccessor::Role::Attribute::BEGIN@9 at line 3
use warnings;
# spent 110µs making 1 call to Moose::Role::BEGIN@3 # spent 62µs making 1 call to warnings::import
4
53125µs2440µs
# spent 267µs (95+172) within Moose::Role::BEGIN@5 which was called: # once (95µs+172µs) by MooseX::SemiAffordanceAccessor::Role::Attribute::BEGIN@9 at line 5
use Scalar::Util 'blessed';
# spent 267µs making 1 call to Moose::Role::BEGIN@5 # spent 172µs making 1 call to Exporter::import
63103µs2333µs
# spent 194µs (54+139) within Moose::Role::BEGIN@6 which was called: # once (54µs+139µs) by MooseX::SemiAffordanceAccessor::Role::Attribute::BEGIN@9 at line 6
use Carp 'croak';
# spent 194µs making 1 call to Moose::Role::BEGIN@6 # spent 139µs making 1 call to Exporter::import
7
83230µs21.35ms
# spent 692µs (37+654) within Moose::Role::BEGIN@8 which was called: # once (37µs+654µs) by MooseX::SemiAffordanceAccessor::Role::Attribute::BEGIN@9 at line 8
use Sub::Exporter;
# spent 692µs making 1 call to Moose::Role::BEGIN@8 # spent 654µs making 1 call to Sub::Exporter::__ANON__[Sub/Exporter.pm:756]
9
1014µsour $VERSION = '1.19';
11163µs$VERSION = eval $VERSION;
# spent 11µs executing statements in string eval
1213µsour $AUTHORITY = 'cpan:STEVAN';
13
14383µs124µs
# spent 24µs within Moose::Role::BEGIN@14 which was called: # once (24µs+0s) by MooseX::SemiAffordanceAccessor::Role::Attribute::BEGIN@9 at line 14
use Moose ();
# spent 24µs making 1 call to Moose::Role::BEGIN@14
15383µs119µs
# spent 19µs within Moose::Role::BEGIN@15 which was called: # once (19µs+0s) by MooseX::SemiAffordanceAccessor::Role::Attribute::BEGIN@9 at line 15
use Moose::Util ();
# spent 19µs making 1 call to Moose::Role::BEGIN@15
16
173126µs2304µs
# spent 169µs (35+135) within Moose::Role::BEGIN@17 which was called: # once (35µs+135µs) by MooseX::SemiAffordanceAccessor::Role::Attribute::BEGIN@9 at line 17
use Moose::Exporter;
# spent 169µs making 1 call to Moose::Role::BEGIN@17 # spent 135µs making 1 call to Moose::Exporter::import
18389µs126µs
# spent 26µs within Moose::Role::BEGIN@18 which was called: # once (26µs+0s) by MooseX::SemiAffordanceAccessor::Role::Attribute::BEGIN@9 at line 18
use Moose::Meta::Role;
# spent 26µs making 1 call to Moose::Role::BEGIN@18
1932.53ms216.1ms
# spent 8.07ms (39µs+8.03) within Moose::Role::BEGIN@19 which was called: # once (39µs+8.03ms) by MooseX::SemiAffordanceAccessor::Role::Attribute::BEGIN@9 at line 19
use Moose::Util::TypeConstraints;
# spent 8.07ms making 1 call to Moose::Role::BEGIN@19 # spent 8.03ms making 1 call to Moose::Exporter::__ANON__[Moose/Exporter.pm:456]
20
21sub extends {
22 croak "Roles do not support 'extends' (you can use 'with' to specialize a role)";
23}
24
25
# spent 1.96s (1.60ms+1.96) within Moose::Role::with which was called 52 times, avg 37.8ms/call: # 26 times (562µs+825ms) by Moose::Role::with at line 359 of Moose/Exporter.pm, avg 31.8ms/call # once (39µs+164ms) by Class::MOP::__ANON__[/home/doy/coding/src/Class-MOP/blib/lib//Class/MOP.pm:118] at line 15 of Moose/Meta/Method/Accessor/Native/Hash/set.pm # once (39µs+128ms) 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 (38µs+115ms) 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/Writer.pm # once (37µs+103ms) 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/get.pm # once (42µs+87.3ms) by Class::MOP::__ANON__[/home/doy/coding/src/Class-MOP/blib/lib//Class/MOP.pm:118] at line 12 of Markdent/Role/BlockParser.pm # once (40µs+68.3ms) 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 (40µs+56.9ms) by Class::MOP::__ANON__[/home/doy/coding/src/Class-MOP/blib/lib//Class/MOP.pm:118] at line 20 of Markdent/Role/HTMLStream.pm # once (37µs+48.6ms) by Class::MOP::__ANON__[/home/doy/coding/src/Class-MOP/blib/lib//Class/MOP.pm:118] at line 12 of Markdent/Role/AnyParser.pm # once (38µs+45.9ms) 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+38.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/Reader.pm # once (39µs+36.3ms) 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 (44µs+27.7ms) by Class::MOP::__ANON__[/home/doy/coding/src/Class-MOP/blib/lib//Class/MOP.pm:118] at line 14 of Markdent/Role/EventsAsMethods.pm # once (38µs+23.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/Bool/unset.pm # once (42µs+22.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/Bool/set.pm # once (39µs+22.2ms) 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/String/clear.pm # once (38µs+21.7ms) 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/Counter/inc.pm # once (39µs+21.7ms) 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/String/append.pm # once (38µs+21.7ms) 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/Counter/dec.pm # once (39µs+14.1ms) 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+14.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/String/length.pm # once (40µs+10.7ms) 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 (56µs+9.11ms) 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/Counter.pm # once (37µs+9.06ms) by Class::MOP::__ANON__[/home/doy/coding/src/Class-MOP/blib/lib//Class/MOP.pm:118] at line 8 of Moose/Meta/Attribute/Native/Trait/String.pm # once (39µs+9.05ms) 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+8.95ms) by Class::MOP::__ANON__[/home/doy/coding/src/Class-MOP/blib/lib//Class/MOP.pm:118] at line 8 of Moose/Meta/Attribute/Native/Trait/Bool.pm # once (44µs+8.87ms) by Class::MOP::__ANON__[/home/doy/coding/src/Class-MOP/blib/lib//Class/MOP.pm:118] at line 12 of Markdent/Role/SpanParser.pm
sub with {
2626542µs26673ms Moose::Util::apply_all_roles( shift, @_ );
# spent 1.13s making 26 calls to Moose::Util::apply_all_roles, avg 43.6ms/call, recursion: max depth 2, sum of overlapping time 461ms
27}
28
29
# spent 7.12ms (656µs+6.47) within Moose::Role::requires which was called 18 times, avg 396µs/call: # 9 times (271µs+2.81ms) by Moose::Role::requires at line 359 of Moose/Exporter.pm, avg 342µs/call # once (61µs+582µs) by Class::MOP::__ANON__[/home/doy/coding/src/Class-MOP/blib/lib//Class/MOP.pm:118] at line 14 of Markdent/Role/SpanParser.pm # once (45µs+575µs) by Class::MOP::__ANON__[/home/doy/coding/src/Class-MOP/blib/lib//Class/MOP.pm:118] at line 12 of Markdent/Role/Handler.pm # once (39µs+479µs) by Class::MOP::__ANON__[/home/doy/coding/src/Class-MOP/blib/lib//Class/MOP.pm:118] at line 22 of Markdent/Role/HTMLStream.pm # once (50µs+419µs) by Class::MOP::__ANON__[/home/doy/coding/src/Class-MOP/blib/lib//Class/MOP.pm:118] at line 14 of Markdent/Role/BlockParser.pm # once (37µs+332µ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 (40µs+325µ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 (39µs+324µ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 (37µs+319µs) by Class::MOP::__ANON__[/home/doy/coding/src/Class-MOP/blib/lib//Class/MOP.pm:118] at line 12 of Markdent/Role/EventAsText.pm # once (37µs+304µ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
sub requires {
30930µs my $meta = shift;
31921µs croak "Must specify at least one method" unless @_;
329205µs92.81ms $meta->add_required_methods(@_);
# spent 2.81ms making 9 calls to Moose::Meta::Role::add_required_methods, avg 312µs/call
33}
34
35sub excludes {
36 my $meta = shift;
37 croak "Must specify at least one role" unless @_;
38 $meta->add_excluded_roles(@_);
39}
40
41
# spent 12.2ms (1.12+11.1) within Moose::Role::has which was called 18 times, avg 680µs/call: # 9 times (754µs+4.95ms) by Moose::Role::has at line 359 of Moose/Exporter.pm, avg 633µs/call # once (56µs+921µs) by Class::MOP::__ANON__[/home/doy/coding/src/Class-MOP/blib/lib//Class/MOP.pm:118] at line 16 of Markdent/Role/BlockParser.pm # once (48µs+851µs) by Class::MOP::__ANON__[/home/doy/coding/src/Class-MOP/blib/lib//Class/MOP.pm:118] at line 24 of Markdent/Role/HTMLStream.pm # once (41µs+717µs) by Class::MOP::__ANON__[/home/doy/coding/src/Class-MOP/blib/lib//Class/MOP.pm:118] at line 8 of MooseX/Role/Parameterized/Meta/Trait/Parameterized.pm # once (41µs+652µs) by Class::MOP::__ANON__[/home/doy/coding/src/Class-MOP/blib/lib//Class/MOP.pm:118] at line 14 of Markdent/Role/AnyParser.pm # once (40µs+627µs) by Class::MOP::__ANON__[/home/doy/coding/src/Class-MOP/blib/lib//Class/MOP.pm:118] at line 14 of Markdent/Role/DebugPrinter.pm # once (36µs+630µs) by Class::MOP::__ANON__[/home/doy/coding/src/Class-MOP/blib/lib//Class/MOP.pm:118] at line 37 of Markdent/Role/HTMLStream.pm # once (37µs+611µ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 (35µs+600µ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+557µs) by Class::MOP::__ANON__[/home/doy/coding/src/Class-MOP/blib/lib//Class/MOP.pm:118] at line 14 of MooseX/Role/Parameterized/Meta/Trait/Parameterized.pm
sub has {
42926µs my $meta = shift;
43930µs my $name = shift;
44926µs croak 'Usage: has \'name\' => ( key => value, ... )' if @_ == 1;
459191µs9366µs my %options = ( definition_context => Moose::Util::_caller_info(), @_ );
# spent 366µs making 9 calls to Moose::Util::_caller_info, avg 41µs/call
46956µs my $attrs = ( ref($name) eq 'ARRAY' ) ? $name : [ ($name) ];
4718401µs94.58ms $meta->add_attribute( $_, %options ) for @$attrs;
# spent 4.58ms making 9 calls to Moose::Meta::Role::add_attribute, avg 509µs/call
48}
49
50
# spent 2.73ms (365µs+2.36) within Moose::Role::_add_method_modifier which was called 13 times, avg 210µs/call: # 8 times (217µs+1.41ms) by Moose::Role::around at line 66, avg 203µs/call # 3 times (94µs+594µs) by Moose::Role::before at line 62, avg 229µs/call # 2 times (54µs+362µs) by Moose::Role::after at line 64, avg 208µs/call
sub _add_method_modifier {
511342µs my $type = shift;
521328µs my $meta = shift;
53
541338µs if ( ref($_[0]) eq 'Regexp' ) {
55 croak "Roles do not currently support regex "
56 . " references for $type method modifiers";
57 }
58
5913271µs132.36ms Moose::Util::add_method_modifier($meta, $type, \@_);
# spent 2.36ms making 13 calls to Moose::Util::add_method_modifier, avg 182µs/call
60}
61
62354µs3688µs
# spent 1.79ms (179µs+1.61) within Moose::Role::before which was called 6 times, avg 298µs/call: # 3 times (66µs+687µs) by Moose::Role::before at line 359 of Moose/Exporter.pm, avg 251µs/call # once (45µs+351µs) by MooseX::SemiAffordanceAccessor::BEGIN@12 at line 34 of MooseX/SemiAffordanceAccessor/Role/Attribute.pm # once (37µs+285µ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 (30µs+287µ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
sub before { _add_method_modifier('before', @_) }
# spent 688µs making 3 calls to Moose::Role::_add_method_modifier, avg 229µs/call
63
64237µs2415µs
# spent 1.12ms (147µs+977µs) within Moose::Role::after which was called 4 times, avg 281µs/call: # 2 times (40µs+415µs) by Moose::Role::after at line 359 of Moose/Exporter.pm, avg 228µs/call # once (45µs+310µs) by MooseX::StrictConstructor::BEGIN@12 at line 30 of MooseX/StrictConstructor/Role/Object.pm # once (62µs+252µ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
sub after { _add_method_modifier('after', @_) }
# spent 415µs making 2 calls to Moose::Role::_add_method_modifier, avg 208µs/call
65
668133µs81.62ms
# spent 4.31ms (434µs+3.87) within Moose::Role::around which was called 16 times, avg 269µs/call: # 8 times (146µs+1.62ms) by Moose::Role::around at line 359 of Moose/Exporter.pm, avg 221µs/call # once (39µs+375µ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 (49µs+313µs) by MooseX::StrictConstructor::BEGIN@13 at line 35 of MooseX/StrictConstructor/Role/Meta/Class.pm # once (36µs+278µs) by Class::MOP::__ANON__[/home/doy/coding/src/Class-MOP/blib/lib//Class/MOP.pm:118] at line 45 of Moose/Meta/Method/Accessor/Native/Hash/set.pm # once (33µs+274µ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 (35µs+273µ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 (34µs+255µ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 (30µs+244µ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 (30µs+239µ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
sub around { _add_method_modifier('around', @_) }
# spent 1.62ms making 8 calls to Moose::Role::_add_method_modifier, avg 203µs/call
67
68# see Moose.pm for discussion
69
# spent 6.85ms (603µs+6.24) within Moose::Role::super which was called 28 times, avg 245µs/call: # 14 times (306µs+3.84ms) 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 296µs/call # 14 times (298µs+2.40ms) 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 193µs/call
sub super {
702863µs return unless $Moose::SUPER_BODY;
7128494µs286.24ms $Moose::SUPER_BODY->(@Moose::SUPER_ARGS);
# spent 3.84ms making 14 calls to Moose::Meta::Method::Accessor::_eval_environment, avg 274µs/call # spent 2.40ms making 14 calls to Moose::Meta::Method::Accessor::_get_value, avg 172µs/call
72}
73
74
# spent 1.76ms (184µs+1.58) within Moose::Role::override which was called 6 times, avg 294µs/call: # 3 times (81µs+681µs) by Moose::Role::override at line 359 of Moose/Exporter.pm, avg 254µ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+253µ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 (30µs+245µ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
sub override {
7538µs my $meta = shift;
76313µs my ( $name, $code ) = @_;
77356µs3680µs $meta->add_override_method_modifier( $name, $code );
# spent 680µs making 3 calls to Moose::Meta::Role::add_override_method_modifier, avg 227µs/call
78}
79
80sub inner {
81 croak "Roles cannot support 'inner'";
82}
83
84sub augment {
85 croak "Roles cannot support 'augment'";
86}
87
88134µs17.20msMoose::Exporter->setup_import_methods(
# spent 7.20ms 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 191ms (6.39+185) within Moose::Role::init_meta which was called 40 times, avg 4.77ms/call: # 38 times (6.02ms+164ms) by Moose::Exporter::__ANON__[/home/doy/coding/src/Moose/blib/lib//Moose/Exporter.pm:456] at line 423 of Moose/Exporter.pm, avg 4.46ms/call # 2 times (372µs+20.9ms) by MooseX::Role::Parameterized::init_meta at line 49 of MooseX/Role/Parameterized.pm, avg 10.6ms/call
sub init_meta {
10040100µs shift;
10140429µs my %args = @_;
102
10340145µs my $role = $args{for_class};
104
1054072µs unless ($role) {
106 require Moose;
107 Moose->throw_error("Cannot call init_meta without specifying a for_class");
108 }
109
11040147µs my $metaclass = $args{metaclass} || "Moose::Meta::Role";
11140164µs my $meta_name = exists $args{meta_name} ? $args{meta_name} : 'meta';
112
113401.15ms40414µs Moose->throw_error("The Metaclass $metaclass must be a subclass of Moose::Meta::Role.")
# spent 414µs making 40 calls to UNIVERSAL::isa, avg 10µs/call
114 unless $metaclass->isa('Moose::Meta::Role');
115
116 # make a subtype for each Moose role
11740882µs8036.4ms role_type $role unless find_type_constraint($role);
# spent 32.6ms making 40 calls to Moose::Util::TypeConstraints::role_type, avg 814µs/call # spent 3.88ms making 40 calls to Moose::Util::TypeConstraints::find_type_constraint, avg 97µs/call
118
1194084µs my $meta;
12040595µs40489µs if ( $meta = Class::MOP::get_metaclass_by_name($role) ) {
# spent 489µs making 40 calls to Class::MOP::get_metaclass_by_name, avg 12µ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 {
13140621µs4041.1ms $meta = $metaclass->initialize($role);
# spent 41.1ms making 40 calls to Moose::Meta::Role::initialize, avg 1.03ms/call
132 }
133
13440281µs if (defined $meta_name) {
135 # also check for inherited non moose 'meta' method?
13640575µs409.13ms my $existing = $meta->get_method($meta_name);
# spent 9.13ms making 40 calls to Class::MOP::Mixin::HasMethods::get_method, avg 228µs/call
1374089µ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 }
14640565µs4096.9ms $meta->_add_meta_method($meta_name);
# spent 96.9ms making 40 calls to Class::MOP::Mixin::HasMethods::_add_meta_method, avg 2.42ms/call
147 }
148
14940696µs return $meta;
150}
151
152131µs1;
153
154__END__