← 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:10:52 2010

Filename/home/doy/coding/src/Moose/blib/lib//Moose/Meta/Class.pm
StatementsExecuted 18013 statements in 319ms
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
7898355.1ms710msMoose::Meta::Class::::superclassesMoose::Meta::Class::superclasses (recurses: max depth 1, inclusive time 43.3ms)
3142147.2ms70.5msMoose::Meta::Class::::_base_metaclassesMoose::Meta::Class::_base_metaclasses
1012229.4ms396msMoose::Meta::Class::::new_objectMoose::Meta::Class::new_object
731118.7ms113msMoose::Meta::Class::::excludes_roleMoose::Meta::Class::excludes_role
18841117.4ms17.4msMoose::Meta::Class::::CORE:substMoose::Meta::Class::CORE:subst (opcode)
42119.89ms569msMoose::Meta::Class::::reinitializeMoose::Meta::Class::reinitialize
132118.83ms118msMoose::Meta::Class::::_inline_slot_initializerMoose::Meta::Class::_inline_slot_initializer
1118.71ms12.7msMoose::Meta::Class::::BEGIN@26Moose::Meta::Class::BEGIN@26
114118.03ms49.8msMoose::Meta::Class::::_inline_init_attr_from_constructorMoose::Meta::Class::_inline_init_attr_from_constructor
132117.55ms11.3msMoose::Meta::Class::::_inline_check_required_attrMoose::Meta::Class::_inline_check_required_attr
72337.43ms2.65sMoose::Meta::Class::::add_attributeMoose::Meta::Class::add_attribute (recurses: max depth 1, inclusive time 74.8ms)
132217.05ms36.5msMoose::Meta::Class::::_inline_init_attr_from_defaultMoose::Meta::Class::_inline_init_attr_from_default
44226.99ms38.7msMoose::Meta::Class::::does_roleMoose::Meta::Class::does_role
158216.86ms9.76msMoose::Meta::Class::::CORE:sortMoose::Meta::Class::CORE:sort (opcode)
116446.58ms1.01sMoose::Meta::Class::::create_anon_classMoose::Meta::Class::create_anon_class
111446.19ms641msMoose::Meta::Class::::initializeMoose::Meta::Class::initialize
42115.51ms31.1msMoose::Meta::Class::::_inline_triggersMoose::Meta::Class::_inline_triggers
73113.71ms6.22msMoose::Meta::Class::::add_roleMoose::Meta::Class::add_role
42113.47ms36.5msMoose::Meta::Class::::_inline_BUILDARGSMoose::Meta::Class::_inline_BUILDARGS
73113.45ms5.31msMoose::Meta::Class::::add_role_applicationMoose::Meta::Class::add_role_application
116113.28ms3.75msMoose::Meta::Class::::_anon_cache_keyMoose::Meta::Class::_anon_cache_key
1112.86ms4.01msMoose::Meta::Class::::BEGIN@24Moose::Meta::Class::BEGIN@24
50112.73ms618msMoose::Meta::Class::::_process_new_attributeMoose::Meta::Class::_process_new_attribute
51112.71ms624msMoose::Meta::Class::::_process_attributeMoose::Meta::Class::_process_attribute
36111.99ms46.0msMoose::Meta::Class::::add_override_method_modifierMoose::Meta::Class::add_override_method_modifier
1111.89ms3.18msMoose::Meta::Class::::BEGIN@23Moose::Meta::Class::BEGIN@23
43111.88ms7.61msMoose::Meta::Class::::_immutable_optionsMoose::Meta::Class::_immutable_options
23211.76ms1.01sMoose::Meta::Class::::createMoose::Meta::Class::create
1111.61ms14.8msMoose::Meta::Class::::BEGIN@21Moose::Meta::Class::BEGIN@21
1111.59ms2.38msMoose::Meta::Class::::BEGIN@22Moose::Meta::Class::BEGIN@22
42111.55ms86.6msMoose::Meta::Class::::_inline_extra_initMoose::Meta::Class::_inline_extra_init
42221.42ms36.1msMoose::Meta::Class::::_inline_BUILDALLMoose::Meta::Class::_inline_BUILDALL
1111.40ms1.89msMoose::Meta::Class::::BEGIN@20Moose::Meta::Class::BEGIN@20
1111.35ms14.7msMoose::Meta::Class::::BEGIN@19Moose::Meta::Class::BEGIN@19
42111.33ms37.9msMoose::Meta::Class::::_inline_paramsMoose::Meta::Class::_inline_params
70211.26ms1.26msMoose::Meta::Class::::_inline_throw_errorMoose::Meta::Class::_inline_throw_error
111111.25ms1.25msMoose::Meta::Class::::__ANON__[:40]Moose::Meta::Class::__ANON__[:40]
111111.25ms1.25msMoose::Meta::Class::::__ANON__[:35]Moose::Meta::Class::__ANON__[:35]
1111.17ms1.85msMoose::Meta::Class::::BEGIN@25Moose::Meta::Class::BEGIN@25
4211807µs807µsMoose::Meta::Class::::_generate_fallback_constructorMoose::Meta::Class::_generate_fallback_constructor
6911677µs677µsMoose::Meta::Class::::_meta_method_classMoose::Meta::Class::_meta_method_class
611502µs1.62msMoose::Meta::Class::::calculate_all_rolesMoose::Meta::Class::calculate_all_roles
5111283µs283µsMoose::Meta::Class::::CORE:matchMoose::Meta::Class::CORE:match (opcode)
111115µs2.43msMoose::Meta::Class::::_process_inherited_attributeMoose::Meta::Class::_process_inherited_attribute
111100µs119µsMoose::Meta::Class::::BEGIN@4Moose::Meta::Class::BEGIN@4
11141µs63µsMoose::Meta::Class::::BEGIN@10Moose::Meta::Class::BEGIN@10
11139µs105µsMoose::Meta::Class::::BEGIN@5Moose::Meta::Class::BEGIN@5
11138µs310µsMoose::Meta::Class::::BEGIN@29Moose::Meta::Class::BEGIN@29
11137µs190µsMoose::Meta::Class::::BEGIN@13Moose::Meta::Class::BEGIN@13
11137µs242µsMoose::Meta::Class::::BEGIN@12Moose::Meta::Class::BEGIN@12
11136µs167µsMoose::Meta::Class::::BEGIN@11Moose::Meta::Class::BEGIN@11
11136µs217µsMoose::Meta::Class::::BEGIN@9Moose::Meta::Class::BEGIN@9
11130µs30µsMoose::Meta::Class::::BEGIN@27Moose::Meta::Class::BEGIN@27
11124µs24µsMoose::Meta::Class::::BEGIN@7Moose::Meta::Class::BEGIN@7
0000s0sMoose::Meta::Class::::_find_next_method_by_name_which_is_not_overriddenMoose::Meta::Class::_find_next_method_by_name_which_is_not_overridden
0000s0sMoose::Meta::Class::::_fix_class_metaclass_incompatibilityMoose::Meta::Class::_fix_class_metaclass_incompatibility
0000s0sMoose::Meta::Class::::_fix_single_metaclass_incompatibilityMoose::Meta::Class::_fix_single_metaclass_incompatibility
0000s0sMoose::Meta::Class::::_replace_selfMoose::Meta::Class::_replace_self
0000s0sMoose::Meta::Class::::add_augment_method_modifierMoose::Meta::Class::add_augment_method_modifier
0000s0sMoose::Meta::Class::::calculate_all_roles_with_inheritanceMoose::Meta::Class::calculate_all_roles_with_inheritance
0000s0sMoose::Meta::Class::::create_errorMoose::Meta::Class::create_error
0000s0sMoose::Meta::Class::::raise_errorMoose::Meta::Class::raise_error
0000s0sMoose::Meta::Class::::role_applicationsMoose::Meta::Class::role_applications
0000s0sMoose::Meta::Class::::throw_errorMoose::Meta::Class::throw_error
Call graph for these subroutines as a Graphviz dot language file.
Line State
ments
Time
on line
Calls Time
in subs
Code
1
2package Moose::Meta::Class;
3
43137µs2138µs
# spent 119µs (100+19) within Moose::Meta::Class::BEGIN@4 which was called: # once (100µs+19µs) by Moose::BEGIN@19 at line 4
use strict;
# spent 119µs making 1 call to Moose::Meta::Class::BEGIN@4 # spent 19µs making 1 call to strict::import
5394µs2172µs
# spent 105µs (39+66) within Moose::Meta::Class::BEGIN@5 which was called: # once (39µs+66µs) by Moose::BEGIN@19 at line 5
use warnings;
# spent 105µs making 1 call to Moose::Meta::Class::BEGIN@5 # spent 66µs making 1 call to warnings::import
6
7395µs124µs
# spent 24µs within Moose::Meta::Class::BEGIN@7 which was called: # once (24µs+0s) by Moose::BEGIN@19 at line 7
use Class::MOP;
# spent 24µs making 1 call to Moose::Meta::Class::BEGIN@7
8
93102µs2399µs
# spent 217µs (36+181) within Moose::Meta::Class::BEGIN@9 which was called: # once (36µs+181µs) by Moose::BEGIN@19 at line 9
use Carp qw( confess );
# spent 217µs making 1 call to Moose::Meta::Class::BEGIN@9 # spent 181µs making 1 call to Exporter::import
103111µs285µs
# spent 63µs (41+22) within Moose::Meta::Class::BEGIN@10 which was called: # once (41µs+22µs) by Moose::BEGIN@19 at line 10
use Data::OptList;
# spent 63µs making 1 call to Moose::Meta::Class::BEGIN@10 # spent 22µs making 1 call to Sub::Install::__ANON__[Sub/Install.pm:284]
113103µs2297µs
# spent 167µs (36+130) within Moose::Meta::Class::BEGIN@11 which was called: # once (36µs+130µs) by Moose::BEGIN@19 at line 11
use List::Util qw( first );
# spent 167µs making 1 call to Moose::Meta::Class::BEGIN@11 # spent 130µs making 1 call to Exporter::import
123105µs2448µs
# spent 242µs (37+206) within Moose::Meta::Class::BEGIN@12 which was called: # once (37µs+206µs) by Moose::BEGIN@19 at line 12
use List::MoreUtils qw( any all uniq first_index );
# spent 242µs making 1 call to Moose::Meta::Class::BEGIN@12 # spent 206µs making 1 call to Exporter::import
133223µs2343µs
# spent 190µs (37+153) within Moose::Meta::Class::BEGIN@13 which was called: # once (37µs+153µs) by Moose::BEGIN@19 at line 13
use Scalar::Util 'weaken', 'blessed';
# spent 190µs making 1 call to Moose::Meta::Class::BEGIN@13 # spent 153µs making 1 call to Exporter::import
14
1514µsour $VERSION = '1.19';
16171µs$VERSION = eval $VERSION;
# spent 12µs executing statements in string eval
1714µsour $AUTHORITY = 'cpan:STEVAN';
18
193480µs114.7ms
# spent 14.7ms (1.35+13.3) within Moose::Meta::Class::BEGIN@19 which was called: # once (1.35ms+13.3ms) by Moose::BEGIN@19 at line 19
use Moose::Meta::Method::Overridden;
# spent 14.7ms making 1 call to Moose::Meta::Class::BEGIN@19
203487µs11.89ms
# spent 1.89ms (1.40+490µs) within Moose::Meta::Class::BEGIN@20 which was called: # once (1.40ms+490µs) by Moose::BEGIN@19 at line 20
use Moose::Meta::Method::Augmented;
# spent 1.89ms making 1 call to Moose::Meta::Class::BEGIN@20
213457µs114.8ms
# spent 14.8ms (1.61+13.1) within Moose::Meta::Class::BEGIN@21 which was called: # once (1.61ms+13.1ms) by Moose::BEGIN@19 at line 21
use Moose::Error::Default;
# spent 14.8ms making 1 call to Moose::Meta::Class::BEGIN@21
223475µs12.38ms
# spent 2.38ms (1.59+789µs) within Moose::Meta::Class::BEGIN@22 which was called: # once (1.59ms+789µs) by Moose::BEGIN@19 at line 22
use Moose::Meta::Class::Immutable::Trait;
# spent 2.38ms making 1 call to Moose::Meta::Class::BEGIN@22
233485µs13.18ms
# spent 3.18ms (1.89+1.30) within Moose::Meta::Class::BEGIN@23 which was called: # once (1.89ms+1.30ms) by Moose::BEGIN@19 at line 23
use Moose::Meta::Method::Constructor;
# spent 3.18ms making 1 call to Moose::Meta::Class::BEGIN@23
243488µs14.01ms
# spent 4.01ms (2.86+1.15) within Moose::Meta::Class::BEGIN@24 which was called: # once (2.86ms+1.15ms) by Moose::BEGIN@19 at line 24
use Moose::Meta::Method::Destructor;
# spent 4.01ms making 1 call to Moose::Meta::Class::BEGIN@24
253459µs11.85ms
# spent 1.85ms (1.17+678µs) within Moose::Meta::Class::BEGIN@25 which was called: # once (1.17ms+678µs) by Moose::BEGIN@19 at line 25
use Moose::Meta::Method::Meta;
# spent 1.85ms making 1 call to Moose::Meta::Class::BEGIN@25
263493µs213.2ms
# spent 12.7ms (8.71+3.94) within Moose::Meta::Class::BEGIN@26 which was called: # once (8.71ms+3.94ms) by Moose::BEGIN@19 at line 26
use Moose::Util;
# spent 12.7ms making 1 call to Moose::Meta::Class::BEGIN@26 # spent 586µs making 1 call to Sub::Exporter::__ANON__[Sub/Exporter.pm:756]
273107µs130µs
# spent 30µs within Moose::Meta::Class::BEGIN@27 which was called: # once (30µs+0s) by Moose::BEGIN@19 at line 27
use Class::MOP::MiniTrait;
# spent 30µs making 1 call to Moose::Meta::Class::BEGIN@27
28
29310.6ms2582µs
# spent 310µs (38+272) within Moose::Meta::Class::BEGIN@29 which was called: # once (38µs+272µs) by Moose::BEGIN@19 at line 29
use base 'Class::MOP::Class';
# spent 310µs making 1 call to Moose::Meta::Class::BEGIN@29 # spent 272µs making 1 call to base::import
30
31115µs18.92msClass::MOP::MiniTrait::apply(__PACKAGE__, 'Moose::Meta::Object::Trait');
# spent 8.92ms making 1 call to Class::MOP::MiniTrait::apply
32
33__PACKAGE__->meta->add_attribute('roles' => (
34 reader => 'roles',
351111.50ms
# spent 1.25ms within Moose::Meta::Class::__ANON__[/home/doy/coding/src/Moose/blib/lib//Moose/Meta/Class.pm:35] which was called 111 times, avg 11µs/call: # 111 times (1.25ms+0s) by Class::MOP::Mixin::AttributeCore::default at line 43 of Class/MOP/Mixin/AttributeCore.pm, avg 11µs/call
default => sub { [] }
36164µs22.71ms));
# spent 2.63ms making 1 call to Class::MOP::Mixin::HasAttributes::add_attribute # spent 81µs making 1 call to Class::MOP::Object::meta
37
38__PACKAGE__->meta->add_attribute('role_applications' => (
39 reader => '_get_role_applications',
401111.44ms
# spent 1.25ms within Moose::Meta::Class::__ANON__[/home/doy/coding/src/Moose/blib/lib//Moose/Meta/Class.pm:40] which was called 111 times, avg 11µs/call: # 111 times (1.25ms+0s) by Class::MOP::Mixin::AttributeCore::default at line 43 of Class/MOP/Mixin/AttributeCore.pm, avg 11µs/call
default => sub { [] }
41132µs22.18ms));
# spent 2.10ms making 1 call to Class::MOP::Mixin::HasAttributes::add_attribute # spent 86µs making 1 call to Class::MOP::Object::meta
42
43141µs32.07ms__PACKAGE__->meta->add_attribute(
# spent 1.86ms making 1 call to Class::MOP::Mixin::HasAttributes::add_attribute # spent 124µs making 1 call to Class::MOP::Attribute::new # spent 86µs making 1 call to Class::MOP::Object::meta
44 Class::MOP::Attribute->new('immutable_trait' => (
45 accessor => "immutable_trait",
46 default => 'Moose::Meta::Class::Immutable::Trait',
47 ))
48);
49
50126µs21.95ms__PACKAGE__->meta->add_attribute('constructor_class' => (
# spent 1.87ms making 1 call to Class::MOP::Mixin::HasAttributes::add_attribute # spent 86µs making 1 call to Class::MOP::Object::meta
51 accessor => 'constructor_class',
52 default => 'Moose::Meta::Method::Constructor',
53));
54
55125µs21.99ms__PACKAGE__->meta->add_attribute('destructor_class' => (
# spent 1.87ms making 1 call to Class::MOP::Mixin::HasAttributes::add_attribute # spent 117µs making 1 call to Class::MOP::Object::meta
56 accessor => 'destructor_class',
57 default => 'Moose::Meta::Method::Destructor',
58));
59
60127µs22.06ms__PACKAGE__->meta->add_attribute('error_class' => (
# spent 1.96ms making 1 call to Class::MOP::Mixin::HasAttributes::add_attribute # spent 98µs making 1 call to Class::MOP::Object::meta
61 accessor => 'error_class',
62 default => 'Moose::Error::Default',
63));
64
65
# spent 641ms (6.19+635) within Moose::Meta::Class::initialize which was called 111 times, avg 5.78ms/call: # 45 times (2.62ms+184ms) by Moose::init_meta at line 199 of Moose.pm, avg 4.14ms/call # 42 times (2.23ms+354ms) by Class::MOP::Package::reinitialize at line 60 of Class/MOP/Package.pm, avg 8.48ms/call # 23 times (1.23ms+91.5ms) by Class::MOP::Class::create at line 513 of Class/MOP/Class.pm, avg 4.03ms/call # once (111µs+6.30ms) by metaclass::import at line 45 of metaclass.pm
sub initialize {
663337.47ms my $class = shift;
67 my $pkg = shift;
68222635ms return Class::MOP::get_metaclass_by_name($pkg)
# spent 634ms making 111 calls to Class::MOP::Class::initialize, avg 5.71ms/call # spent 1.00ms making 111 calls to Class::MOP::get_metaclass_by_name, avg 9µs/call
69 || $class->SUPER::initialize($pkg,
70 'attribute_metaclass' => 'Moose::Meta::Attribute',
71 'method_metaclass' => 'Moose::Meta::Method',
72 'instance_metaclass' => 'Moose::Meta::Instance',
73 @_
74 );
75}
76
77
# spent 1.01s (1.76ms+1.00) within Moose::Meta::Class::create which was called 23 times, avg 43.7ms/call: # 22 times (1.70ms+992ms) by Class::MOP::Class::create_anon_class at line 441 of Class/MOP/Class.pm, avg 45.2ms/call # once (62µs+12.0ms) by Class::MOP::Class::_immutable_metaclass at line 1387 of Class/MOP/Class.pm
sub create {
781381.75ms my ($class, $package_name, %options) = @_;
79
80 (ref $options{roles} eq 'ARRAY')
81 || $class->throw_error("You must pass an ARRAY ref of roles", data => $options{roles})
82 if exists $options{roles};
83 my $roles = delete $options{roles};
84
8523318ms my $new_meta = $class->SUPER::create($package_name, %options);
# spent 318ms making 23 calls to Class::MOP::Class::create, avg 13.8ms/call
86
8720686ms if ($roles) {
# spent 686ms making 20 calls to Moose::Util::apply_all_roles, avg 34.3ms/call
88 Moose::Util::apply_all_roles( $new_meta, @$roles );
89 }
90
91 return $new_meta;
92}
93
9412µsmy %ANON_CLASSES;
95
96
# spent 1.01s (6.58ms+999ms) within Moose::Meta::Class::create_anon_class which was called 116 times, avg 8.66ms/call: # 80 times (3.76ms+60.1ms) by Moose::Util::MetaRole::_make_new_class at line 163 of Moose/Util/MetaRole.pm, avg 799µs/call # 28 times (2.06ms+660ms) by Moose::Meta::Attribute::Native::Trait::_native_accessor_class_for at line 173 of Moose/Meta/Attribute/Native/Trait.pm, avg 23.7ms/call # 6 times (570µs+253ms) by Moose::Meta::Attribute::interpolate_class at line 129 of Moose/Meta/Attribute.pm, avg 42.3ms/call # 2 times (184µs+25.0ms) by MooseX::Role::Parameterized::Meta::Role::Parameterizable::__ANON__[/home/doy/perl5/perlbrew/perls/perl-5.10.1/lib/site_perl/5.10.1/MooseX/Role/Parameterized/Meta/Role/Parameterizable.pm:31] at line 27 of MooseX/Role/Parameterized/Meta/Role/Parameterizable.pm, avg 12.6ms/call
sub create_anon_class {
975526.34ms my ($self, %options) = @_;
98
99 my $cache_ok = delete $options{cache};
100
1011163.75ms my $cache_key
# spent 3.75ms making 116 calls to Moose::Meta::Class::_anon_cache_key, avg 32µs/call
102 = _anon_cache_key( $options{superclasses}, $options{roles} );
103
104 if ($cache_ok && defined $ANON_CLASSES{$cache_key}) {
105 return $ANON_CLASSES{$cache_key};
106 }
107
108 $options{weaken} = !$cache_ok
109 unless exists $options{weaken};
110
11122995ms my $new_class = $self->SUPER::create_anon_class(%options);
# spent 995ms making 22 calls to Class::MOP::Class::create_anon_class, avg 45.2ms/call
112
11340534µs if ($cache_ok) {
114 $ANON_CLASSES{$cache_key} = $new_class;
11520127µs weaken($ANON_CLASSES{$cache_key});
# spent 127µs making 20 calls to Scalar::Util::weaken, avg 6µs/call
116 }
117
118 return $new_class;
119}
120
12169864µs
# spent 677µs within Moose::Meta::Class::_meta_method_class which was called 69 times, avg 10µs/call: # 69 times (677µs+0s) by Class::MOP::Mixin::HasMethods::_add_meta_method at line 28 of Class/MOP/Mixin/HasMethods.pm, avg 10µs/call
sub _meta_method_class { 'Moose::Meta::Method::Meta' }
122
123
# spent 3.75ms (3.28+475µs) within Moose::Meta::Class::_anon_cache_key which was called 116 times, avg 32µs/call: # 116 times (3.28ms+475µs) by Moose::Meta::Class::create_anon_class at line 101, avg 32µs/call
sub _anon_cache_key {
124 # Makes something like Super::Class|Super::Class::2=Role|Role::1
125 return join '=' => (
126 join( '|', @{ $_[0] || [] } ),
1271163.86ms116475µs join( '|', sort @{ $_[1] || [] } ),
# spent 475µs making 116 calls to Moose::Meta::Class::CORE:sort, avg 4µs/call
128 );
129}
130
131
# spent 569ms (9.89+560) within Moose::Meta::Class::reinitialize which was called 42 times, avg 13.6ms/call: # 42 times (9.89ms+560ms) by Moose::Util::MetaRole::_make_new_metaclass at line 128 of Moose/Util/MetaRole.pm, avg 13.6ms/call
sub reinitialize {
1323363.71ms my $self = shift;
133 my $pkg = shift;
134
13542251µs my $meta = blessed $pkg ? $pkg : Class::MOP::class_of($pkg);
# spent 251µs making 42 calls to Scalar::Util::blessed, avg 6µs/call
136
137 my $cache_key;
138
139 my %existing_classes;
140846.95ms if ($meta) {
1412942.82ms %existing_classes = map { $_ => $meta->$_() } qw(
# spent 644µs making 42 calls to Moose::Meta::Class::destructor_class, avg 15µs/call # spent 637µs making 42 calls to Moose::Meta::Class::constructor_class, avg 15µs/call # spent 574µs making 42 calls to Moose::Meta::Class::error_class, avg 14µs/call # spent 295µs making 42 calls to Class::MOP::Mixin::HasAttributes::attribute_metaclass, avg 7µs/call # spent 239µs making 42 calls to Class::MOP::Mixin::HasMethods::method_metaclass, avg 6µs/call # spent 229µs making 42 calls to Class::MOP::Class::instance_metaclass, avg 5µs/call # spent 203µs making 42 calls to Class::MOP::Mixin::HasMethods::wrapped_method_metaclass, avg 5µs/call
142 attribute_metaclass
143 method_metaclass
144 wrapped_method_metaclass
145 instance_metaclass
146 constructor_class
147 destructor_class
148 error_class
149 );
150
151 $cache_key = _anon_cache_key(
152 [ $meta->superclasses ],
153421.81ms [ map { $_->name } @{ $meta->roles } ],
# spent 1.81ms making 42 calls to Class::MOP::Class::is_anon_class, avg 43µs/call
154 ) if $meta->is_anon_class;
155 }
156
15742555ms my $new_meta = $self->SUPER::reinitialize(
# spent 555ms making 42 calls to Class::MOP::Class::reinitialize, avg 13.2ms/call
158 $pkg,
159 %existing_classes,
160 @_,
161 );
162
163 return $new_meta unless defined $cache_key;
164
165 my $new_cache_key = _anon_cache_key(
166 [ $meta->superclasses ],
167 [ map { $_->name } @{ $meta->roles } ],
168 );
169
170 delete $ANON_CLASSES{$cache_key};
171 $ANON_CLASSES{$new_cache_key} = $new_meta;
172 weaken($ANON_CLASSES{$new_cache_key});
173
174 return $new_meta;
175}
176
177
# spent 6.22ms (3.71+2.51) within Moose::Meta::Class::add_role which was called 73 times, avg 85µs/call: # 73 times (3.71ms+2.51ms) by Moose::Meta::Role::Application::ToClass::apply at line 33 of Moose/Meta/Role/Application/ToClass.pm, avg 85µs/call
sub add_role {
1782194.53ms my ($self, $role) = @_;
1791461.01ms (blessed($role) && $role->isa('Moose::Meta::Role'))
# spent 535µs making 73 calls to Scalar::Util::blessed, avg 7µs/call # spent 474µs making 73 calls to UNIVERSAL::isa, avg 6µs/call
180 || $self->throw_error("Roles must be instances of Moose::Meta::Role", data => $role);
181731.50ms push @{$self->roles} => $role;
# spent 1.50ms making 73 calls to Moose::Meta::Class::roles, avg 21µs/call
182}
183
184sub role_applications {
185 my ($self) = @_;
186
187 return @{$self->_get_role_applications};
188}
189
190
# spent 5.31ms (3.45+1.86) within Moose::Meta::Class::add_role_application which was called 73 times, avg 73µs/call: # 73 times (3.45ms+1.86ms) by Moose::Meta::Role::Application::ToClass::apply at line 34 of Moose/Meta/Role/Application/ToClass.pm, avg 73µs/call
sub add_role_application {
1912194.15ms my ($self, $application) = @_;
192146838µs (blessed($application) && $application->isa('Moose::Meta::Role::Application::ToClass'))
# spent 426µs making 73 calls to UNIVERSAL::isa, avg 6µs/call # spent 412µs making 73 calls to Scalar::Util::blessed, avg 6µs/call
193 || $self->throw_error("Role applications must be instances of Moose::Meta::Role::Application::ToClass", data => $application);
194731.02ms push @{$self->_get_role_applications} => $application;
# spent 1.02ms making 73 calls to Moose::Meta::Class::_get_role_applications, avg 14µs/call
195}
196
197
# spent 1.62ms (502µs+1.12) within Moose::Meta::Class::calculate_all_roles which was called 6 times, avg 271µs/call: # 6 times (502µs+1.12ms) by Moose::Meta::Attribute::Native::Trait::_build_native_type at line 184 of Moose/Meta/Attribute/Native/Trait.pm, avg 271µs/call
sub calculate_all_roles {
19818228µs my $self = shift;
199 my %seen;
20018311µs241.12ms grep { !$seen{$_->name}++ } map { $_->calculate_all_roles } @{ $self->roles };
# spent 982µs making 6 calls to Moose::Meta::Role::calculate_all_roles, avg 164µs/call # spent 80µs making 6 calls to Moose::Meta::Class::roles, avg 13µs/call # spent 60µs making 12 calls to Class::MOP::Package::name, avg 5µs/call
201}
202
203sub calculate_all_roles_with_inheritance {
204 my $self = shift;
205 my %seen;
206 grep { !$seen{$_->name}++ }
207 map { Class::MOP::class_of($_)->can('calculate_all_roles')
208 ? Class::MOP::class_of($_)->calculate_all_roles
209 : () }
210 $self->linearized_isa;
211}
212
213
# spent 38.7ms (6.99+31.7) within Moose::Meta::Class::does_role which was called 44 times, avg 879µs/call: # 38 times (5.09ms+26.5ms) by List::MoreUtils::all at line 160 of Moose/Util/MetaRole.pm, avg 832µs/call # 6 times (1.89ms+5.16ms) by Moose::Object::does at line 125 of Moose/Object.pm, avg 1.17ms/call
sub does_role {
2141761.77ms my ($self, $role_name) = @_;
215
216 (defined $role_name)
217 || $self->throw_error("You must supply a role name to look for");
218
2194425.6ms foreach my $class ($self->class_precedence_list) {
# spent 25.6ms making 44 calls to Class::MOP::Class::class_precedence_list, avg 581µs/call
2203425.39ms1303.65ms my $meta = Class::MOP::class_of($class);
# spent 3.65ms making 130 calls to Class::MOP::class_of, avg 28µs/call
221 # when a Moose metaclass is itself extended with a role,
222 # this check needs to be done since some items in the
223 # class_precedence_list might in fact be Class::MOP
224 # based still.
225130841µs next unless $meta && $meta->can('roles');
# spent 841µs making 130 calls to UNIVERSAL::can, avg 6µs/call
226821.07ms foreach my $role (@{$meta->roles}) {
# spent 1.07ms making 82 calls to Moose::Meta::Class::roles, avg 13µs/call
2276106µs6564µs return 1 if $role->does_role($role_name);
# spent 564µs making 6 calls to Moose::Meta::Role::does_role, avg 94µs/call
228 }
229 }
230 return 0;
231}
232
233
# spent 113ms (18.7+94.3) within Moose::Meta::Class::excludes_role which was called 73 times, avg 1.55ms/call: # 73 times (18.7ms+94.3ms) by Moose::Meta::Role::Application::ToClass::check_role_exclusions at line 39 of Moose/Meta/Role/Application/ToClass.pm, avg 1.55ms/call
sub excludes_role {
2342922.99ms my ($self, $role_name) = @_;
235
236 (defined $role_name)
237 || $self->throw_error("You must supply a role name to look for");
238
2397373.9ms foreach my $class ($self->class_precedence_list) {
# spent 73.9ms making 73 calls to Class::MOP::Class::class_precedence_list, avg 1.01ms/call
240103615.5ms42712.1ms my $meta = Class::MOP::class_of($class);
# spent 12.1ms making 427 calls to Class::MOP::class_of, avg 28µs/call
241 # when a Moose metaclass is itself extended with a role,
242 # this check needs to be done since some items in the
243 # class_precedence_list might in fact be Class::MOP
244 # based still.
2454272.73ms next unless $meta && $meta->can('roles');
# spent 2.73ms making 427 calls to UNIVERSAL::can, avg 6µs/call
2461822.34ms foreach my $role (@{$meta->roles}) {
# spent 2.34ms making 182 calls to Moose::Meta::Class::roles, avg 13µs/call
247761.26ms763.15ms return 1 if $role->excludes_role($role_name);
# spent 3.15ms making 76 calls to Moose::Meta::Role::excludes_role, avg 41µs/call
248 }
249 }
250 return 0;
251}
252
253
# spent 396ms (29.4+366) within Moose::Meta::Class::new_object which was called 101 times, avg 3.92ms/call: # 59 times (25.1ms+318ms) by Moose::Meta::Attribute::_new or Moose::Meta::Role::_new at line 4 of generated method (unknown origin), avg 5.81ms/call # 42 times (4.22ms+48.5ms) by MooseX::Role::Parameterized::Meta::Role::Parameterizable::construct_parameters at line 68 of MooseX/Role/Parameterized/Meta/Role/Parameterizable.pm, avg 1.26ms/call
sub new_object {
2546069.51ms my $self = shift;
255 my $params = @_ == 1 ? $_[0] : {@_};
256101330ms my $object = $self->SUPER::new_object($params);
# spent 330ms making 101 calls to Class::MOP::Class::new_object, avg 3.27ms/call
257
25810125.6ms foreach my $attr ( $self->get_all_attributes() ) {
# spent 22.8ms making 57 calls to Class::MOP::Class::get_all_attributes, avg 400µs/call # spent 2.78ms making 44 calls to Class::MOP::Class::Immutable::Moose::Meta::Class::get_all_attributes, avg 63µs/call
259
260149827.9ms16089.01ms next unless $attr->can('has_trigger') && $attr->has_trigger;
# spent 7.86ms making 1498 calls to UNIVERSAL::can, avg 5µs/call # spent 1.15ms making 110 calls to Moose::Meta::Mixin::AttributeCore::has_trigger, avg 10µs/call
261
262 my $init_arg = $attr->init_arg;
263
264 next unless defined $init_arg;
265
266 next unless exists $params->{$init_arg};
267
268 $attr->trigger->(
269 $object,
270 (
271 $attr->should_coerce
272 ? $attr->get_read_method_ref->($object)
273 : $params->{$init_arg}
274 ),
275 );
276 }
277
2781431.94ms $object->BUILDALL($params) if $object->can('BUILDALL');
# spent 1.05ms making 42 calls to Moose::Object::BUILDALL, avg 25µs/call # spent 894µs making 101 calls to UNIVERSAL::can, avg 9µs/call
279
280 return $object;
281}
282
283
# spent 807µs within Moose::Meta::Class::_generate_fallback_constructor which was called 42 times, avg 19µs/call: # 42 times (807µs+0s) by Class::MOP::Class::_inline_fallback_constructor at line 607 of Class/MOP/Class.pm, avg 19µs/call
sub _generate_fallback_constructor {
284126926µs my $self = shift;
285 my ($class) = @_;
286 return $class . '->Moose::Object::new(@_)'
287}
288
289
# spent 37.9ms (1.33+36.5) within Moose::Meta::Class::_inline_params which was called 42 times, avg 902µs/call: # 42 times (1.33ms+36.5ms) by Class::MOP::Class::_inline_new_object at line 591 of Class/MOP/Class.pm, avg 902µs/call
sub _inline_params {
2901261.36ms my $self = shift;
291 my ($params, $class) = @_;
292 return (
2934236.5ms 'my ' . $params . ' = ',
# spent 36.5ms making 42 calls to Moose::Meta::Class::_inline_BUILDARGS, avg 870µs/call
294 $self->_inline_BUILDARGS($class, '@_'),
295 ';',
296 );
297}
298
299
# spent 36.5ms (3.47+33.1) within Moose::Meta::Class::_inline_BUILDARGS which was called 42 times, avg 870µs/call: # 42 times (3.47ms+33.1ms) by Moose::Meta::Class::_inline_params at line 293, avg 870µs/call
sub _inline_BUILDARGS {
3001683.57ms my $self = shift;
301 my ($class, $args) = @_;
302
3034231.9ms my $buildargs = $self->find_method_by_name("BUILDARGS");
# spent 31.9ms making 42 calls to Class::MOP::Class::find_method_by_name, avg 760µs/call
304
305811.14ms if ($args eq '@_'
# spent 811µs making 42 calls to Moose::Meta::Class::_inline_throw_error, avg 19µs/call # spent 332µs making 39 calls to Class::MOP::Method::body, avg 9µs/call
306 && (!$buildargs or $buildargs->body == \&Moose::Object::BUILDARGS)) {
307 return (
308 'do {',
309 'my $params;',
310 'if (scalar @_ == 1) {',
311 'if (!defined($_[0]) || ref($_[0]) ne \'HASH\') {',
312 $self->_inline_throw_error(
313 '"Single parameters to new() must be a HASH ref"',
314 'data => $_[0]',
315 ) . ';',
316 '}',
317 '$params = { %{ $_[0] } };',
318 '}',
319 'elsif (@_ % 2) {',
320 'Carp::carp(',
321 '"The new() method for ' . $class . ' expects a '
322 . 'hash reference or a key/value list. You passed an '
323 . 'odd number of arguments"',
324 ');',
325 '$params = {@_, undef};',
326 '}',
327 'else {',
328 '$params = {@_};',
329 '}',
330 '$params;',
331 '}',
332 );
333 }
334 else {
335 return $class . '->BUILDARGS(' . $args . ')';
336 }
337}
338
339
# spent 118ms (8.83+109) within Moose::Meta::Class::_inline_slot_initializer which was called 132 times, avg 893µs/call: # 132 times (8.83ms+109ms) by Class::MOP::Class::_inline_slot_initializers at line 645 of Class/MOP/Class.pm, avg 893µs/call
sub _inline_slot_initializer {
3403969.12ms my $self = shift;
341 my ($attr, $idx) = @_;
342
343 return (
344396109ms '## ' . $attr->name,
# spent 97.1ms making 132 calls to Class::MOP::Class::_inline_slot_initializer, avg 735µs/call # spent 11.3ms making 132 calls to Moose::Meta::Class::_inline_check_required_attr, avg 85µs/call # spent 760µs making 132 calls to Class::MOP::Mixin::AttributeCore::name, avg 6µs/call
345 $self->_inline_check_required_attr($attr),
346 $self->SUPER::_inline_slot_initializer(@_),
347 );
348}
349
350
# spent 11.3ms (7.55+3.71) within Moose::Meta::Class::_inline_check_required_attr which was called 132 times, avg 85µs/call: # 132 times (7.55ms+3.71ms) by Moose::Meta::Class::_inline_slot_initializer at line 344, avg 85µs/call
sub _inline_check_required_attr {
3515669.35ms my $self = shift;
352 my ($attr) = @_;
353
354132754µs return unless defined $attr->init_arg;
# spent 754µs making 132 calls to Class::MOP::Mixin::AttributeCore::init_arg, avg 6µs/call
3551621.62ms return unless $attr->can('is_required') && $attr->is_required;
# spent 934µs making 114 calls to UNIVERSAL::can, avg 8µs/call # spent 689µs making 48 calls to Moose::Meta::Mixin::AttributeCore::is_required, avg 14µs/call
35656610µs return if $attr->has_default || $attr->has_builder;
# spent 308µs making 28 calls to Class::MOP::Mixin::AttributeCore::has_default, avg 11µs/call # spent 302µs making 28 calls to Class::MOP::Mixin::AttributeCore::has_builder, avg 11µs/call
357
358 return (
35984720µs 'if (!exists $params->{\'' . $attr->init_arg . '\'}) {',
# spent 454µs making 28 calls to Moose::Meta::Class::_inline_throw_error, avg 16µs/call # spent 141µs making 28 calls to Class::MOP::Mixin::AttributeCore::init_arg, avg 5µs/call # spent 126µs making 28 calls to Class::MOP::Mixin::AttributeCore::name, avg 4µs/call
360 $self->_inline_throw_error(
361 '"Attribute (' . quotemeta($attr->name) . ') is required"'
362 ) . ';',
363 '}',
364 );
365}
366
367# XXX: these two are duplicated from cmop, because we have to pass the tc stuff
368# through to _inline_set_value - this should probably be fixed, but i'm not
369# quite sure how. -doy
370
# spent 49.8ms (8.03+41.8) within Moose::Meta::Class::_inline_init_attr_from_constructor which was called 114 times, avg 437µs/call: # 114 times (8.03ms+41.8ms) by Class::MOP::Class::_inline_slot_initializer at line 654 of Class/MOP/Class.pm, avg 437µs/call
sub _inline_init_attr_from_constructor {
3715707.99ms my $self = shift;
372 my ($attr, $idx) = @_;
373
37422840.4ms my @initial_value = $attr->_inline_set_value(
# spent 26.2ms making 48 calls to Moose::Meta::Attribute::_inline_set_value, avg 545µs/call # spent 13.6ms making 66 calls to Class::MOP::Attribute::_inline_set_value, avg 207µs/call # spent 594µs making 114 calls to Class::MOP::Mixin::AttributeCore::init_arg, avg 5µs/call
375 '$instance',
376 '$params->{\'' . $attr->init_arg . '\'}',
377 '$type_constraint_bodies[' . $idx . ']',
378 '$type_constraints[' . $idx . ']',
379 'for constructor',
380 );
381
3821141.37ms push @initial_value, (
# spent 1.37ms making 114 calls to Class::MOP::Mixin::AttributeCore::has_initializer, avg 12µs/call
383 '$attrs->[' . $idx . ']->set_initial_value(',
384 '$instance,',
385 $attr->_inline_instance_get('$instance'),
386 ');',
387 ) if $attr->has_initializer;
388
389 return @initial_value;
390}
391
392
# spent 36.5ms (7.05+29.5) within Moose::Meta::Class::_inline_init_attr_from_default which was called 132 times, avg 277µs/call: # 114 times (5.64ms+21.2ms) by Class::MOP::Class::_inline_slot_initializer at line 659 of Class/MOP/Class.pm, avg 236µs/call # 18 times (1.40ms+8.25ms) by Class::MOP::Class::_inline_slot_initializer at line 653 of Class/MOP/Class.pm, avg 536µs/call
sub _inline_init_attr_from_default {
3937266.43ms my $self = shift;
394 my ($attr, $idx) = @_;
395
3961329.30ms my $default = $self->_inline_default_value($attr, $idx);
# spent 9.30ms making 132 calls to Class::MOP::Class::_inline_default_value, avg 70µs/call
397 return unless $default;
398
3996619.5ms my @initial_value = (
# spent 11.7ms making 22 calls to Moose::Meta::Attribute::_inline_set_value, avg 533µs/call # spent 7.78ms making 44 calls to Class::MOP::Attribute::_inline_set_value, avg 177µs/call
400 'my $default = ' . $default . ';',
401 $attr->_inline_set_value(
402 '$instance',
403 '$default',
404 '$type_constraint_bodies[' . $idx . ']',
405 '$type_constraints[' . $idx . ']',
406 'for constructor',
407 ),
408 );
409
41066670µs push @initial_value, (
# spent 670µs making 66 calls to Class::MOP::Mixin::AttributeCore::has_initializer, avg 10µs/call
411 '$attrs->[' . $idx . ']->set_initial_value(',
412 '$instance,',
413 $attr->_inline_instance_get('$instance'),
414 ');',
415 ) if $attr->has_initializer;
416
417 return @initial_value;
418}
419
420
# spent 86.6ms (1.55+85.1) within Moose::Meta::Class::_inline_extra_init which was called 42 times, avg 2.06ms/call: # 42 times (1.55ms+85.1ms) by Class::MOP::Class::_inline_new_object at line 591 of Class/MOP/Class.pm, avg 2.06ms/call
sub _inline_extra_init {
421841.47ms my $self = shift;
422 return (
4238485.1ms $self->_inline_triggers,
# spent 46.8ms making 37 calls to Class::MOP::Class::__ANON__::SERIAL::2::_inline_BUILDALL, avg 1.27ms/call # spent 31.1ms making 42 calls to Moose::Meta::Class::_inline_triggers, avg 741µs/call # spent 7.13ms making 5 calls to Moose::Meta::Class::_inline_BUILDALL, avg 1.43ms/call
424 $self->_inline_BUILDALL,
425 );
426}
427
428
# spent 31.1ms (5.51+25.6) within Moose::Meta::Class::_inline_triggers which was called 42 times, avg 741µs/call: # 42 times (5.51ms+25.6ms) by Moose::Meta::Class::_inline_extra_init at line 423, avg 741µs/call
sub _inline_triggers {
42953011.7ms my $self = shift;
430 my @trigger_calls;
431
43272427.1ms my @attrs = sort { $a->name cmp $b->name } $self->get_all_attributes;
# spent 14.9ms making 42 calls to Class::MOP::Class::get_all_attributes, avg 354µs/call # spent 9.29ms making 42 calls to Moose::Meta::Class::CORE:sort, avg 221µs/call # spent 2.90ms making 640 calls to Class::MOP::Mixin::AttributeCore::name, avg 5µs/call
433 for my $i (0 .. $#attrs) {
4342643.70ms my $attr = $attrs[$i];
435
4361921.48ms next unless $attr->can('has_trigger') && $attr->has_trigger;
# spent 841µs making 132 calls to UNIVERSAL::can, avg 6µs/call # spent 636µs making 60 calls to Moose::Meta::Mixin::AttributeCore::has_trigger, avg 11µs/call
437
438 my $init_arg = $attr->init_arg;
439 next unless defined $init_arg;
440
441 push @trigger_calls,
442 'if (exists $params->{\'' . $init_arg . '\'}) {',
443 '$attrs->[' . $i . ']->trigger->(',
444 '$instance,',
445 $attr->_inline_instance_get('$instance') . ',',
446 ');',
447 '}';
448 }
449
450 return @trigger_calls;
451}
452
453
# spent 36.1ms (1.42+34.7) within Moose::Meta::Class::_inline_BUILDALL which was called 42 times, avg 859µs/call: # 37 times (1.24ms+27.7ms) by Class::MOP::Class:::around at line 18 of MooseX/StrictConstructor/Role/Meta/Class.pm, avg 782µs/call # 5 times (186µs+6.95ms) by Moose::Meta::Class::_inline_extra_init at line 423, avg 1.43ms/call
sub _inline_BUILDALL {
4542101.44ms my $self = shift;
455
4564234.7ms my @methods = reverse $self->find_all_methods_by_name('BUILD');
# spent 34.7ms making 42 calls to Class::MOP::Class::find_all_methods_by_name, avg 825µs/call
457 my @BUILD_calls;
458
459 foreach my $method (@methods) {
460114µs push @BUILD_calls,
461 '$instance->' . $method->{class} . '::BUILD($params);';
462 }
463
464 return @BUILD_calls;
465}
466
467
# spent 710ms (55.1+655) within Moose::Meta::Class::superclasses which was called 789 times, avg 900µs/call: # 264 times (14.9ms+34.3ms) by Class::MOP::Class::class_precedence_list at line 1070 of Class/MOP/Class.pm, avg 186µs/call # 220 times (13.8ms+18.1ms) by Class::MOP::Class::_check_metaclass_compatibility at line 201 of Class/MOP/Class.pm, avg 145µs/call # 109 times (7.10ms+-7.10ms) by Class::MOP::Class::_superclasses_updated at line 1011 of Class/MOP/Class.pm, avg 0s/call # 90 times (8.20ms+241ms) by Moose::init_meta at line 218 of Moose.pm, avg 2.77ms/call # 42 times (2.92ms+6.06ms) by Moose::Util::MetaRole::apply_base_class_roles at line 140 of Moose/Util/MetaRole.pm, avg 214µs/call # 38 times (4.41ms+195ms) by Moose::Util::MetaRole::apply_base_class_roles at line 146 of Moose/Util/MetaRole.pm, avg 5.25ms/call # 23 times (3.38ms+153ms) by Class::MOP::Class::create at line 520 of Class/MOP/Class.pm, avg 6.78ms/call # 3 times (351µs+14.7ms) by Moose::extends at line 54 of Moose.pm, avg 5.02ms/call
sub superclasses {
468315646.6ms my $self = shift;
46978930.4ms my $supers = Data::OptList::mkopt(\@_);
# spent 30.4ms making 789 calls to Data::OptList::mkopt, avg 39µs/call
470 foreach my $super (@{ $supers }) {
4714847.38ms my ($name, $opts) = @{ $super };
47212124.9ms Class::MOP::load_class($name, $opts);
# spent 27.1ms making 121 calls to Class::MOP::load_class, avg 224µs/call, recursion: max depth 2, sum of overlapping time 2.20ms
4731214.15ms my $meta = Class::MOP::class_of($name);
# spent 4.15ms making 121 calls to Class::MOP::class_of, avg 34µs/call
4741201.60ms $self->throw_error("You cannot inherit from a Moose Role ($name)")
# spent 1.60ms making 120 calls to UNIVERSAL::isa, avg 13µs/call
475 if $meta && $meta->isa('Moose::Meta::Role')
476 }
477789613ms return $self->SUPER::superclasses(map { $_->[0] } @{ $supers });
# spent 635ms making 789 calls to Class::MOP::Class::superclasses, avg 805µs/call, recursion: max depth 1, sum of overlapping time 22.4ms
478}
479
480### ---------------------------------------------
481
482
# spent 2.65s (7.43ms+2.65) within Moose::Meta::Class::add_attribute which was called 72 times, avg 36.9ms/call: # 50 times (5.28ms+2.57s) by Moose::has at line 70 of Moose.pm, avg 51.5ms/call # 21 times (2.01ms+67.0ms) by Moose::Meta::Role::Application::ToClass::apply_attributes at line 142 of Moose/Meta/Role/Application/ToClass.pm, avg 3.29ms/call # once (146µs+9.08ms) by MooseX::Role::Parameterized::Meta::Role::Parameterizable::add_parameter at line 55 of MooseX/Role/Parameterized/Meta/Role/Parameterizable.pm
sub add_attribute {
4833608.58ms my $self = shift;
484144624ms my $attr =
# spent 624ms making 51 calls to Moose::Meta::Class::_process_attribute, avg 12.2ms/call # spent 389µs making 72 calls to Scalar::Util::blessed, avg 5µs/call # spent 153µs making 21 calls to UNIVERSAL::isa, avg 7µs/call
485 (blessed $_[0] && $_[0]->isa('Class::MOP::Attribute')
486 ? $_[0]
487 : $self->_process_attribute(@_));
488722.09s $self->SUPER::add_attribute($attr);
# spent 2.09s making 72 calls to Class::MOP::Mixin::HasAttributes::add_attribute, avg 29.1ms/call
489 # it may be a Class::MOP::Attribute, theoretically, which doesn't have
490 # 'bare' and doesn't implement this method
4911433.09ms if ($attr->can('_check_associated_methods')) {
# spent 2.16ms making 71 calls to Moose::Meta::Attribute::_check_associated_methods, avg 30µs/call # spent 929µs making 72 calls to UNIVERSAL::can, avg 13µs/call
492 $attr->_check_associated_methods;
493 }
494 return $attr;
495}
496
497
# spent 46.0ms (1.99+44.0) within Moose::Meta::Class::add_override_method_modifier which was called 36 times, avg 1.28ms/call: # 36 times (1.99ms+44.0ms) by Moose::Meta::Role::Application::ToClass::apply_override_method_modifiers at line 208 of Moose/Meta/Role/Application/ToClass.pm, avg 1.28ms/call
sub add_override_method_modifier {
4981081.81ms my ($self, $name, $method, $_super_package) = @_;
499
500365.02ms (!$self->has_method($name))
# spent 5.02ms making 36 calls to Class::MOP::Mixin::HasMethods::has_method, avg 139µs/call
501 || $self->throw_error("Cannot add an override method if a local method is already present");
502
5037239.0ms $self->add_method($name => Moose::Meta::Method::Overridden->new(
# spent 23.9ms making 36 calls to Moose::Meta::Method::Overridden::new, avg 663µs/call # spent 15.1ms making 36 calls to Class::MOP::Mixin::HasMethods::add_method, avg 420µs/call
504 method => $method,
505 class => $self,
506 package => $_super_package, # need this for roles
507 name => $name,
508 ));
509}
510
511sub add_augment_method_modifier {
512 my ($self, $name, $method) = @_;
513 (!$self->has_method($name))
514 || $self->throw_error("Cannot add an augment method if a local method is already present");
515
516 $self->add_method($name => Moose::Meta::Method::Augmented->new(
517 method => $method,
518 class => $self,
519 name => $name,
520 ));
521}
522
523## Private Utility methods ...
524
525sub _find_next_method_by_name_which_is_not_overridden {
526 my ($self, $name) = @_;
527 foreach my $method ($self->find_all_methods_by_name($name)) {
528 return $method->{code}
529 if blessed($method->{code}) && !$method->{code}->isa('Moose::Meta::Method::Overridden');
530 }
531 return undef;
532}
533
534## Metaclass compatibility
535
536
# spent 70.5ms (47.2+23.3) within Moose::Meta::Class::_base_metaclasses which was called 314 times, avg 224µs/call: # 163 times (24.8ms+12.4ms) by Class::MOP::Class::_can_fix_metaclass_incompatibility at line 331 of Class/MOP/Class.pm, avg 228µs/call # 151 times (22.4ms+10.9ms) by Class::MOP::Class::_check_metaclass_compatibility at line 206 of Class/MOP/Class.pm, avg 220µs/call
sub _base_metaclasses {
537125622.6ms my $self = shift;
5383145.93ms my %metaclasses = $self->SUPER::_base_metaclasses;
# spent 5.93ms making 314 calls to Class::MOP::Class::_base_metaclasses, avg 19µs/call
539 for my $class (keys %metaclasses) {
540188441.3ms188417.4ms $metaclasses{$class} =~ s/^Class::MOP/Moose::Meta/;
# spent 17.4ms making 1884 calls to Moose::Meta::Class::CORE:subst, avg 9µs/call
541 }
542 return (
543 %metaclasses,
544 error_class => 'Moose::Error::Default',
545 );
546}
547
548sub _fix_class_metaclass_incompatibility {
549 my $self = shift;
550 my ($super_meta) = @_;
551
552 $self->SUPER::_fix_class_metaclass_incompatibility(@_);
553
554 if ($self->_class_metaclass_can_be_made_compatible($super_meta)) {
555 ($self->is_pristine)
556 || confess "Can't fix metaclass incompatibility for "
557 . $self->name
558 . " because it is not pristine.";
559 my $super_meta_name = $super_meta->_real_ref_name;
560 my $class_meta_subclass_meta_name = Moose::Util::_reconcile_roles_for_metaclass(blessed($self), $super_meta_name);
561 my $new_self = $class_meta_subclass_meta_name->reinitialize(
562 $self->name,
563 );
564
565 $self->_replace_self( $new_self, $class_meta_subclass_meta_name );
566 }
567}
568
569sub _fix_single_metaclass_incompatibility {
570 my $self = shift;
571 my ($metaclass_type, $super_meta) = @_;
572
573 $self->SUPER::_fix_single_metaclass_incompatibility(@_);
574
575 if ($self->_single_metaclass_can_be_made_compatible($super_meta, $metaclass_type)) {
576 ($self->is_pristine)
577 || confess "Can't fix metaclass incompatibility for "
578 . $self->name
579 . " because it is not pristine.";
580 my $super_meta_name = $super_meta->_real_ref_name;
581 my $class_specific_meta_subclass_meta_name = Moose::Util::_reconcile_roles_for_metaclass($self->$metaclass_type, $super_meta->$metaclass_type);
582 my $new_self = $super_meta->reinitialize(
583 $self->name,
584 $metaclass_type => $class_specific_meta_subclass_meta_name,
585 );
586
587 $self->_replace_self( $new_self, $super_meta_name );
588 }
589}
590
591sub _replace_self {
592 my $self = shift;
593 my ( $new_self, $new_class) = @_;
594
595 %$self = %$new_self;
596 bless $self, $new_class;
597
598 # We need to replace the cached metaclass instance or else when it goes
599 # out of scope Class::MOP::Class destroy's the namespace for the
600 # metaclass's class, causing much havoc.
601 my $weaken = Class::MOP::metaclass_is_weak( $self->name );
602 Class::MOP::store_metaclass_by_name( $self->name, $self );
603 Class::MOP::weaken_metaclass( $self->name ) if $weaken;
604}
605
606
# spent 624ms (2.71+621) within Moose::Meta::Class::_process_attribute which was called 51 times, avg 12.2ms/call: # 51 times (2.71ms+621ms) by Moose::Meta::Class::add_attribute at line 484, avg 12.2ms/call
sub _process_attribute {
6071531.59ms my ( $self, $name, @args ) = @_;
608
609 @args = %{$args[0]} if scalar @args == 1 && ref($args[0]) eq 'HASH';
610
611511.40ms51283µs if (($name || '') =~ /^\+(.*)/) {
# spent 283µs making 51 calls to Moose::Meta::Class::CORE:match, avg 6µs/call
61212.43ms return $self->_process_inherited_attribute($1, @args);
# spent 2.43ms making 1 call to Moose::Meta::Class::_process_inherited_attribute
613 }
614 else {
61550618ms return $self->_process_new_attribute($name, @args);
# spent 618ms making 50 calls to Moose::Meta::Class::_process_new_attribute, avg 12.4ms/call
616 }
617}
618
619
# spent 618ms (2.73+616) within Moose::Meta::Class::_process_new_attribute which was called 50 times, avg 12.4ms/call: # 50 times (2.73ms+616ms) by Moose::Meta::Class::_process_attribute at line 615, avg 12.4ms/call
sub _process_new_attribute {
6201003.00ms my ( $self, $name, @args ) = @_;
621
622100616ms $self->attribute_metaclass->interpolate_class_and_new($name, @args);
# spent 615ms making 50 calls to Moose::Meta::Attribute::interpolate_class_and_new, avg 12.3ms/call # spent 398µs making 50 calls to Class::MOP::Mixin::HasAttributes::attribute_metaclass, avg 8µs/call
623}
624
625
# spent 2.43ms (115µs+2.31) within Moose::Meta::Class::_process_inherited_attribute which was called: # once (115µs+2.31ms) by Moose::Meta::Class::_process_attribute at line 612
sub _process_inherited_attribute {
626479µs my ($self, $attr_name, %options) = @_;
6271800µs my $inherited_attr = $self->find_attribute_by_name($attr_name);
# spent 800µs making 1 call to Class::MOP::Class::find_attribute_by_name
628 (defined $inherited_attr)
629 || $self->throw_error("Could not find an attribute by the name of '$attr_name' to inherit from in ${\$self->name}", data => $attr_name);
630139µs114µs if ($inherited_attr->isa('Moose::Meta::Attribute')) {
# spent 14µs making 1 call to UNIVERSAL::isa
631 return $inherited_attr->clone_and_inherit_options(%options);
632 }
633 else {
634 # NOTE:
635 # kind of a kludge to handle Class::MOP::Attributes
63611.50ms return $inherited_attr->Moose::Meta::Attribute::clone_and_inherit_options(%options);
# spent 1.50ms making 1 call to Moose::Meta::Attribute::clone_and_inherit_options
637 }
638}
639
640## Immutability
641
642
# spent 7.61ms (1.88+5.73) within Moose::Meta::Class::_immutable_options which was called 43 times, avg 177µs/call: # 43 times (1.88ms+5.73ms) by Class::MOP::Class::make_immutable at line 1321 of Class/MOP/Class.pm, avg 177µs/call
sub _immutable_options {
643861.77ms my ( $self, @args ) = @_;
644
645435.73ms $self->SUPER::_immutable_options(
# spent 5.73ms making 43 calls to Class::MOP::Class::_immutable_options, avg 133µs/call
646 inline_destructor => 1,
647
648 # Moose always does this when an attribute is created
649 inline_accessors => 0,
650
651 @args,
652 );
653}
654
655## -------------------------------------------------
656
65712µsour $error_level;
658
659sub throw_error {
660 my ( $self, @args ) = @_;
661 local $error_level = ($error_level || 0) + 1;
662 $self->raise_error($self->create_error(@args));
663}
664
665
# spent 1.26ms within Moose::Meta::Class::_inline_throw_error which was called 70 times, avg 18µs/call: # 42 times (811µs+0s) by Moose::Meta::Class::_inline_BUILDARGS at line 305, avg 19µs/call # 28 times (454µs+0s) by Moose::Meta::Class::_inline_check_required_attr at line 359, avg 16µs/call
sub _inline_throw_error {
6661401.53ms my ( $self, $msg, $args ) = @_;
667 "\$meta->throw_error($msg" . ($args ? ", $args" : "") . ")"; # FIXME makes deparsing *REALLY* hard
668}
669
670sub raise_error {
671 my ( $self, @args ) = @_;
672 die @args;
673}
674
675sub create_error {
676 my ( $self, @args ) = @_;
677
678 require Carp::Heavy;
679
680 local $error_level = ($error_level || 0 ) + 1;
681
682 if ( @args % 2 == 1 ) {
683 unshift @args, "message";
684 }
685
686 my %args = ( metaclass => $self, last_error => $@, @args );
687
688 $args{depth} += $error_level;
689
690 my $class = ref $self ? $self->error_class : "Moose::Error::Default";
691
692 Class::MOP::load_class($class);
693
694 $class->new(
695 Carp::caller_info($args{depth}),
696 %args
697 );
698}
699
700162µs1;
701
702__END__
 
# spent 283µs within Moose::Meta::Class::CORE:match which was called 51 times, avg 6µs/call: # 51 times (283µs+0s) by Moose::Meta::Class::_process_attribute at line 611, avg 6µs/call
sub Moose::Meta::Class::CORE:match; # opcode
# spent 9.76ms (6.86+2.90) within Moose::Meta::Class::CORE:sort which was called 158 times, avg 62µs/call: # 116 times (475µs+0s) by Moose::Meta::Class::_anon_cache_key at line 127, avg 4µs/call # 42 times (6.39ms+2.90ms) by Moose::Meta::Class::_inline_triggers at line 432, avg 221µs/call
sub Moose::Meta::Class::CORE:sort; # opcode
# spent 17.4ms within Moose::Meta::Class::CORE:subst which was called 1884 times, avg 9µs/call: # 1884 times (17.4ms+0s) by Moose::Meta::Class::_base_metaclasses at line 540, avg 9µs/call
sub Moose::Meta::Class::CORE:subst; # opcode