← Index
NYTProf Performance Profile   « line view »
For /home/ss5/perl5/perlbrew/perls/perl-5.22.0/bin/benchmarkanything-storage
  Run on Mon Jan 29 16:55:34 2018
Reported on Mon Jan 29 16:57:06 2018

Filename/home/ss5/perl5/perlbrew/perls/perl-5.22.0/lib/site_perl/5.22.0/x86_64-linux/Moose/Meta/Class.pm
StatementsExecuted 313 statements in 3.02ms
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
111459µs627µsMoose::Meta::Class::::BEGIN@17Moose::Meta::Class::BEGIN@17
111227µs373µsMoose::Meta::Class::::BEGIN@15Moose::Meta::Class::BEGIN@15
111213µs1.75msMoose::Meta::Class::::BEGIN@13Moose::Meta::Class::BEGIN@13
111213µs366µsMoose::Meta::Class::::BEGIN@16Moose::Meta::Class::BEGIN@16
111210µs329µsMoose::Meta::Class::::BEGIN@14Moose::Meta::Class::BEGIN@14
111146µs189µsMoose::Meta::Class::::BEGIN@18Moose::Meta::Class::BEGIN@18
11177µs210µsMoose::Meta::Class::::_eval_environmentMoose::Meta::Class::_eval_environment
41160µs13.1msMoose::Meta::Class::::add_attributeMoose::Meta::Class::add_attribute
63240µs577µsMoose::Meta::Class::::superclassesMoose::Meta::Class::superclasses (recurses: max depth 1, inclusive time 40µs)
41134µs251µsMoose::Meta::Class::::_inline_init_attr_from_defaultMoose::Meta::Class::_inline_init_attr_from_default
41132µs40µsMoose::Meta::Class::::_inline_check_required_attrMoose::Meta::Class::_inline_check_required_attr
11128µs70µsMoose::Meta::Class::::_inline_triggersMoose::Meta::Class::_inline_triggers
41127µs4.21msMoose::Meta::Class::::_process_attributeMoose::Meta::Class::_process_attribute
41126µs359µsMoose::Meta::Class::::_inline_init_attr_from_constructorMoose::Meta::Class::_inline_init_attr_from_constructor
22125µs34µsMoose::Meta::Class::::_base_metaclassesMoose::Meta::Class::_base_metaclasses
41125µs4.18msMoose::Meta::Class::::_process_new_attributeMoose::Meta::Class::_process_new_attribute
41120µs711µsMoose::Meta::Class::::_inline_slot_initializerMoose::Meta::Class::_inline_slot_initializer
22119µs22µsMoose::Meta::Class::::CORE:sortMoose::Meta::Class::CORE:sort (opcode)
22219µs905µsMoose::Meta::Class::::initializeMoose::Meta::Class::initialize
11118µs175µsMoose::Meta::Class::::_inline_BUILDARGSMoose::Meta::Class::_inline_BUILDARGS
11114µs189µsMoose::Meta::Class::::_inline_paramsMoose::Meta::Class::_inline_params
11110µs11µsMoose::Meta::Class::::BEGIN@4Moose::Meta::Class::BEGIN@4
1119µs40µsMoose::Meta::Class::::BEGIN@9Moose::Meta::Class::BEGIN@9
12116µs6µsMoose::Meta::Class::::CORE:substMoose::Meta::Class::CORE:subst (opcode)
1116µs63µsMoose::Meta::Class::::_inline_BUILDALLMoose::Meta::Class::_inline_BUILDALL
1116µs25µsMoose::Meta::Class::::_immutable_optionsMoose::Meta::Class::_immutable_options
1116µs139µsMoose::Meta::Class::::_inline_extra_initMoose::Meta::Class::_inline_extra_init
2215µs5µsMoose::Meta::Class::::_inline_throw_exceptionMoose::Meta::Class::_inline_throw_exception
1115µs20µsMoose::Meta::Class::::BEGIN@11Moose::Meta::Class::BEGIN@11
1115µs165µsMoose::Meta::Class::::BEGIN@10Moose::Meta::Class::BEGIN@10
1115µs86µsMoose::Meta::Class::::BEGIN@19Moose::Meta::Class::BEGIN@19
1114µs7µsMoose::Meta::Class::::BEGIN@5Moose::Meta::Class::BEGIN@5
1114µs9µsMoose::Meta::Class::::BEGIN@8Moose::Meta::Class::BEGIN@8
1114µs21µsMoose::Meta::Class::::BEGIN@22Moose::Meta::Class::BEGIN@22
1113µs3µsMoose::Meta::Class::::BEGIN@20Moose::Meta::Class::BEGIN@20
2113µs3µsMoose::Meta::Class::::__ANON__[:34]Moose::Meta::Class::__ANON__[:34]
2112µs2µsMoose::Meta::Class::::__ANON__[:28]Moose::Meta::Class::__ANON__[:28]
1112µs2µsMoose::Meta::Class::::_generate_fallback_constructorMoose::Meta::Class::_generate_fallback_constructor
2112µs2µsMoose::Meta::Class::::_meta_method_classMoose::Meta::Class::_meta_method_class
4112µs2µsMoose::Meta::Class::::CORE:matchMoose::Meta::Class::CORE:match (opcode)
1112µs2µsMoose::Meta::Class::::BEGIN@7Moose::Meta::Class::BEGIN@7
0000s0sMoose::Meta::Class::::__ANON__[:110]Moose::Meta::Class::__ANON__[:110]
0000s0sMoose::Meta::Class::::__ANON__[:535]Moose::Meta::Class::__ANON__[:535]
0000s0sMoose::Meta::Class::::_anon_cache_keyMoose::Meta::Class::_anon_cache_key
0000s0sMoose::Meta::Class::::_anon_package_prefixMoose::Meta::Class::_anon_package_prefix
0000s0sMoose::Meta::Class::::_call_all_triggersMoose::Meta::Class::_call_all_triggers
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::::_fixup_attributes_after_reblessMoose::Meta::Class::_fixup_attributes_after_rebless
0000s0sMoose::Meta::Class::::_process_inherited_attributeMoose::Meta::Class::_process_inherited_attribute
0000s0sMoose::Meta::Class::::_replace_selfMoose::Meta::Class::_replace_self
0000s0sMoose::Meta::Class::::_restore_metaobjects_fromMoose::Meta::Class::_restore_metaobjects_from
0000s0sMoose::Meta::Class::::_roles_with_inheritanceMoose::Meta::Class::_roles_with_inheritance
0000s0sMoose::Meta::Class::::add_augment_method_modifierMoose::Meta::Class::add_augment_method_modifier
0000s0sMoose::Meta::Class::::add_override_method_modifierMoose::Meta::Class::add_override_method_modifier
0000s0sMoose::Meta::Class::::add_roleMoose::Meta::Class::add_role
0000s0sMoose::Meta::Class::::add_role_applicationMoose::Meta::Class::add_role_application
0000s0sMoose::Meta::Class::::calculate_all_rolesMoose::Meta::Class::calculate_all_roles
0000s0sMoose::Meta::Class::::calculate_all_roles_with_inheritanceMoose::Meta::Class::calculate_all_roles_with_inheritance
0000s0sMoose::Meta::Class::::createMoose::Meta::Class::create
0000s0sMoose::Meta::Class::::does_roleMoose::Meta::Class::does_role
0000s0sMoose::Meta::Class::::excludes_roleMoose::Meta::Class::excludes_role
0000s0sMoose::Meta::Class::::new_objectMoose::Meta::Class::new_object
0000s0sMoose::Meta::Class::::reinitializeMoose::Meta::Class::reinitialize
0000s0sMoose::Meta::Class::::role_applicationsMoose::Meta::Class::role_applications
Call graph for these subroutines as a Graphviz dot language file.
Line State
ments
Time
on line
Calls Time
in subs
Code
1package Moose::Meta::Class;
21400nsour $VERSION = '2.1605';
3
4214µs212µs
# spent 11µs (10+1) within Moose::Meta::Class::BEGIN@4 which was called: # once (10µs+1µs) by Moose::BEGIN@24 at line 4
use strict;
# spent 11µs making 1 call to Moose::Meta::Class::BEGIN@4 # spent 1µs making 1 call to strict::import
5211µs210µs
# spent 7µs (4+3) within Moose::Meta::Class::BEGIN@5 which was called: # once (4µs+3µs) by Moose::BEGIN@24 at line 5
use warnings;
# spent 7µs making 1 call to Moose::Meta::Class::BEGIN@5 # spent 3µs making 1 call to warnings::import
6
7211µs12µs
# spent 2µs within Moose::Meta::Class::BEGIN@7 which was called: # once (2µs+0s) by Moose::BEGIN@24 at line 7
use Class::MOP;
# spent 2µs making 1 call to Moose::Meta::Class::BEGIN@7
8217µs214µs
# spent 9µs (4+5) within Moose::Meta::Class::BEGIN@8 which was called: # once (4µs+5µs) by Moose::BEGIN@24 at line 8
use Data::OptList;
# spent 9µs making 1 call to Moose::Meta::Class::BEGIN@8 # spent 5µs making 1 call to Sub::Install::__ANON__[Sub/Install.pm:270]
9326µs352µs
# spent 40µs (9+31) within Moose::Meta::Class::BEGIN@9 which was called: # once (9µs+31µs) by Moose::BEGIN@24 at line 9
use List::Util 1.33 qw( any first );
# spent 40µs making 1 call to Moose::Meta::Class::BEGIN@9 # spent 6µs making 1 call to UNIVERSAL::VERSION # spent 6µs making 1 call to List::Util::import
10223µs2324µs
# spent 165µs (5+160) within Moose::Meta::Class::BEGIN@10 which was called: # once (5µs+160µs) by Moose::BEGIN@24 at line 10
use List::MoreUtils qw( uniq first_index );
# spent 165µs making 1 call to Moose::Meta::Class::BEGIN@10 # spent 160µs making 1 call to Exporter::Tiny::import
11215µs236µs
# spent 20µs (5+15) within Moose::Meta::Class::BEGIN@11 which was called: # once (5µs+15µs) by Moose::BEGIN@24 at line 11
use Scalar::Util 'blessed';
# spent 20µs making 1 call to Moose::Meta::Class::BEGIN@11 # spent 15µs making 1 call to Exporter::import
12
13270µs11.75ms
# spent 1.75ms (213µs+1.54) within Moose::Meta::Class::BEGIN@13 which was called: # once (213µs+1.54ms) by Moose::BEGIN@24 at line 13
use Moose::Meta::Method::Overridden;
# spent 1.75ms making 1 call to Moose::Meta::Class::BEGIN@13
14266µs1329µs
# spent 329µs (210+119) within Moose::Meta::Class::BEGIN@14 which was called: # once (210µs+119µs) by Moose::BEGIN@24 at line 14
use Moose::Meta::Method::Augmented;
# spent 329µs making 1 call to Moose::Meta::Class::BEGIN@14
15264µs1373µs
# spent 373µs (227+146) within Moose::Meta::Class::BEGIN@15 which was called: # once (227µs+146µs) by Moose::BEGIN@24 at line 15
use Moose::Meta::Class::Immutable::Trait;
# spent 373µs making 1 call to Moose::Meta::Class::BEGIN@15
16273µs1366µs
# spent 366µs (213+153) within Moose::Meta::Class::BEGIN@16 which was called: # once (213µs+153µs) by Moose::BEGIN@24 at line 16
use Moose::Meta::Method::Constructor;
# spent 366µs making 1 call to Moose::Meta::Class::BEGIN@16
17277µs1627µs
# spent 627µs (459+168) within Moose::Meta::Class::BEGIN@17 which was called: # once (459µs+168µs) by Moose::BEGIN@24 at line 17
use Moose::Meta::Method::Destructor;
# spent 627µs making 1 call to Moose::Meta::Class::BEGIN@17
18262µs1189µs
# spent 189µs (146+43) within Moose::Meta::Class::BEGIN@18 which was called: # once (146µs+43µs) by Moose::BEGIN@24 at line 18
use Moose::Meta::Method::Meta;
# spent 189µs making 1 call to Moose::Meta::Class::BEGIN@18
19218µs2167µs
# spent 86µs (5+81) within Moose::Meta::Class::BEGIN@19 which was called: # once (5µs+81µs) by Moose::BEGIN@24 at line 19
use Moose::Util 'throw_exception';
# spent 86µs making 1 call to Moose::Meta::Class::BEGIN@19 # spent 81µs making 1 call to Sub::Exporter::__ANON__[Sub/Exporter.pm:337]
20213µs13µs
# spent 3µs within Moose::Meta::Class::BEGIN@20 which was called: # once (3µs+0s) by Moose::BEGIN@24 at line 20
use Class::MOP::MiniTrait;
# spent 3µs making 1 call to Moose::Meta::Class::BEGIN@20
21
2221.92ms239µs
# spent 21µs (4+18) within Moose::Meta::Class::BEGIN@22 which was called: # once (4µs+18µs) by Moose::BEGIN@24 at line 22
use parent 'Class::MOP::Class';
# spent 21µs making 1 call to Moose::Meta::Class::BEGIN@22 # spent 18µs making 1 call to parent::import
23
2412µs15.25msClass::MOP::MiniTrait::apply(__PACKAGE__, 'Moose::Meta::Object::Trait');
# spent 5.25ms making 1 call to Class::MOP::MiniTrait::apply
25
26__PACKAGE__->meta->add_attribute('roles' => (
27 reader => 'roles',
2824µs
# spent 2µs within Moose::Meta::Class::__ANON__[/home/ss5/perl5/perlbrew/perls/perl-5.22.0/lib/site_perl/5.22.0/x86_64-linux/Moose/Meta/Class.pm:28] which was called 2 times, avg 1µs/call: # 2 times (2µs+0s) by Class::MOP::Mixin::AttributeCore::default at line 40 of Class/MOP/Mixin/AttributeCore.pm, avg 1µs/call
default => sub { [] },
29110µs3318µs Class::MOP::_definition_context(),
# spent 304µs making 1 call to Class::MOP::Mixin::HasAttributes::add_attribute # spent 8µs making 1 call to Class::MOP::Object::meta # spent 6µs making 1 call to Class::MOP::_definition_context
30));
31
32__PACKAGE__->meta->add_attribute('role_applications' => (
33 reader => '_get_role_applications',
3424µs
# spent 3µs within Moose::Meta::Class::__ANON__[/home/ss5/perl5/perlbrew/perls/perl-5.22.0/lib/site_perl/5.22.0/x86_64-linux/Moose/Meta/Class.pm:34] which was called 2 times, avg 1µs/call: # 2 times (3µs+0s) by Class::MOP::Mixin::AttributeCore::default at line 40 of Class/MOP/Mixin/AttributeCore.pm, avg 1µs/call
default => sub { [] },
3513µs3191µs Class::MOP::_definition_context(),
# spent 182µs making 1 call to Class::MOP::Mixin::HasAttributes::add_attribute # spent 6µs making 1 call to Class::MOP::Object::meta # spent 3µs making 1 call to Class::MOP::_definition_context
36));
37
3813µs4190µs__PACKAGE__->meta->add_attribute(
# spent 170µs making 1 call to Class::MOP::Mixin::HasAttributes::add_attribute # spent 11µs making 1 call to Class::MOP::Attribute::new # spent 6µs making 1 call to Class::MOP::Object::meta # spent 3µs making 1 call to Class::MOP::_definition_context
39 Class::MOP::Attribute->new('immutable_trait' => (
40 accessor => "immutable_trait",
41 default => 'Moose::Meta::Class::Immutable::Trait',
42 Class::MOP::_definition_context(),
43 ))
44);
45
4612µs3173µs__PACKAGE__->meta->add_attribute('constructor_class' => (
# spent 165µs making 1 call to Class::MOP::Mixin::HasAttributes::add_attribute # spent 6µs making 1 call to Class::MOP::Object::meta # spent 3µs making 1 call to Class::MOP::_definition_context
47 accessor => 'constructor_class',
48 default => 'Moose::Meta::Method::Constructor',
49 Class::MOP::_definition_context(),
50));
51
5212µs3177µs__PACKAGE__->meta->add_attribute('destructor_class' => (
# spent 169µs making 1 call to Class::MOP::Mixin::HasAttributes::add_attribute # spent 5µs making 1 call to Class::MOP::Object::meta # spent 3µs making 1 call to Class::MOP::_definition_context
53 accessor => 'destructor_class',
54 default => 'Moose::Meta::Method::Destructor',
55 Class::MOP::_definition_context(),
56));
57
58
# spent 905µs (19+886) within Moose::Meta::Class::initialize which was called 2 times, avg 453µs/call: # once (10µs+483µs) by metaclass::import at line 38 of metaclass.pm # once (9µs+403µs) by Moose::init_meta at line 203 of Moose.pm
sub initialize {
592800ns my $class = shift;
6021µs my @args = @_;
6122µs unshift @args, 'package' if @args % 2;
6222µs my %opts = @args;
6321µs my $package = delete $opts{package};
64213µs4886µs return Class::MOP::get_metaclass_by_name($package)
# spent 884µs making 2 calls to Class::MOP::Class::initialize, avg 442µs/call # spent 1µs making 2 calls to Class::MOP::get_metaclass_by_name, avg 700ns/call
65 || $class->SUPER::initialize($package,
66 'attribute_metaclass' => 'Moose::Meta::Attribute',
67 'method_metaclass' => 'Moose::Meta::Method',
68 'instance_metaclass' => 'Moose::Meta::Instance',
69 %opts,
70 );
71}
72
73sub create {
74 my $class = shift;
75 my @args = @_;
76
77 unshift @args, 'package' if @args % 2 == 1;
78 my %options = @args;
79
80 (ref $options{roles} eq 'ARRAY')
81 || throw_exception( RolesInCreateTakesAnArrayRef => params => \%options )
82 if exists $options{roles};
83
84 my $package = delete $options{package};
85 my $roles = delete $options{roles};
86
87 my $new_meta = $class->SUPER::create($package, %options);
88
89 if ($roles) {
90 Moose::Util::apply_all_roles( $new_meta, @$roles );
91 }
92
93 return $new_meta;
94}
95
9624µs
# spent 2µs within Moose::Meta::Class::_meta_method_class which was called 2 times, avg 1µs/call: # 2 times (2µs+0s) by Class::MOP::Mixin::HasMethods::_add_meta_method at line 24 of Class/MOP/Mixin/HasMethods.pm, avg 1µs/call
sub _meta_method_class { 'Moose::Meta::Method::Meta' }
97
98sub _anon_package_prefix { 'Moose::Meta::Class::__ANON__::SERIAL::' }
99
100sub _anon_cache_key {
101 my $class = shift;
102 my %options = @_;
103
104 my $superclass_key = join('|',
105 map { $_->[0] } @{ Data::OptList::mkopt($options{superclasses} || []) }
106 );
107
108 my $roles = Data::OptList::mkopt(($options{roles} || []), {
109 moniker => 'role',
110 val_test => sub { ref($_[0]) eq 'HASH' },
111 });
112
113 my @role_keys;
114 for my $role_spec (@$roles) {
115 my ($role, $params) = @$role_spec;
116 $params = { %$params } if $params;
117
118 my $key = blessed($role) ? $role->name : $role;
119
120 if ($params && %$params) {
121 my $alias = delete $params->{'-alias'}
122 || delete $params->{'alias'}
123 || {};
124 my $excludes = delete $params->{'-excludes'}
125 || delete $params->{'excludes'}
126 || [];
127 $excludes = [$excludes] unless ref($excludes) eq 'ARRAY';
128
129 if (%$params) {
130 warn "Roles with parameters cannot be cached. Consider "
131 . "applying the parameters before calling "
132 . "create_anon_class, or using 'weaken => 0' instead";
133 return;
134 }
135
136 my $alias_key = join('%',
137 map { $_ => $alias->{$_} } sort keys %$alias
138 );
139 my $excludes_key = join('%',
140 sort @$excludes
141 );
142 $key .= '<' . join('+', 'a', $alias_key, 'e', $excludes_key) . '>';
143 }
144
145 push @role_keys, $key;
146 }
147
148 my $role_key = join('|', sort @role_keys);
149
150 # Makes something like Super::Class|Super::Class::2=Role|Role::1
151 return join('=', $superclass_key, $role_key);
152}
153
154sub reinitialize {
155 my $self = shift;
156 my $pkg = shift;
157
158 my $meta = blessed $pkg ? $pkg : Class::MOP::class_of($pkg);
159
160 my %existing_classes;
161 if ($meta) {
162 %existing_classes = map { $_ => $meta->$_() } qw(
163 attribute_metaclass
164 method_metaclass
165 wrapped_method_metaclass
166 instance_metaclass
167 constructor_class
168 destructor_class
169 );
170 }
171
172 return $self->SUPER::reinitialize(
173 $pkg,
174 %existing_classes,
175 @_,
176 );
177}
178
179sub add_role {
180 my ($self, $role) = @_;
181 (blessed($role) && $role->isa('Moose::Meta::Role'))
182 || throw_exception( AddRoleTakesAMooseMetaRoleInstance => role_to_be_added => $role,
183 class_name => $self->name,
184 );
185 push @{$self->roles} => $role;
186}
187
188sub role_applications {
189 my ($self) = @_;
190
191 return @{$self->_get_role_applications};
192}
193
194sub add_role_application {
195 my ($self, $application) = @_;
196
197 (blessed($application) && $application->isa('Moose::Meta::Role::Application::ToClass'))
198 || throw_exception( InvalidRoleApplication => class_name => $self->name,
199 application => $application,
200 );
201
202 push @{$self->_get_role_applications} => $application;
203}
204
205sub calculate_all_roles {
206 my $self = shift;
207 my %seen;
208 grep { !$seen{$_->name}++ } map { $_->calculate_all_roles } @{ $self->roles };
209}
210
211sub _roles_with_inheritance {
212 my $self = shift;
213 my %seen;
214 grep { !$seen{$_->name}++ }
215 map { Class::MOP::class_of($_)->can('roles')
216 ? @{ Class::MOP::class_of($_)->roles }
217 : () }
218 $self->linearized_isa;
219}
220
221sub calculate_all_roles_with_inheritance {
222 my $self = shift;
223 my %seen;
224 grep { !$seen{$_->name}++ }
225 map { Class::MOP::class_of($_)->can('calculate_all_roles')
226 ? Class::MOP::class_of($_)->calculate_all_roles
227 : () }
228 $self->linearized_isa;
229}
230
231sub does_role {
232 my ($self, $role_name) = @_;
233
234 (defined $role_name)
235 || throw_exception( RoleNameRequired => class_name => $self->name );
236
237 foreach my $class ($self->class_precedence_list) {
238 my $meta = Class::MOP::class_of($class);
239 # when a Moose metaclass is itself extended with a role,
240 # this check needs to be done since some items in the
241 # class_precedence_list might in fact be Class::MOP
242 # based still.
243 next unless $meta && $meta->can('roles');
244 foreach my $role (@{$meta->roles}) {
245 return 1 if $role->does_role($role_name);
246 }
247 }
248 return 0;
249}
250
251sub excludes_role {
252 my ($self, $role_name) = @_;
253
254 (defined $role_name)
255 || throw_exception( RoleNameRequired => class_name => $self->name );
256
257 foreach my $class ($self->class_precedence_list) {
258 my $meta = Class::MOP::class_of($class);
259 # when a Moose metaclass is itself extended with a role,
260 # this check needs to be done since some items in the
261 # class_precedence_list might in fact be Class::MOP
262 # based still.
263 next unless $meta && $meta->can('roles');
264 foreach my $role (@{$meta->roles}) {
265 return 1 if $role->excludes_role($role_name);
266 }
267 }
268 return 0;
269}
270
271sub new_object {
272 my $self = shift;
273 my $params = @_ == 1 ? $_[0] : {@_};
274 my $object = $self->SUPER::new_object($params);
275
276 $self->_call_all_triggers($object, $params);
277
278 $object->BUILDALL($params) if $object->can('BUILDALL');
279
280 return $object;
281}
282
283sub _call_all_triggers {
284 my ($self, $object, $params) = @_;
285
286 foreach my $attr ( $self->get_all_attributes() ) {
287
288 next unless $attr->can('has_trigger') && $attr->has_trigger;
289
290 my $init_arg = $attr->init_arg;
291 next unless defined $init_arg;
292 next unless exists $params->{$init_arg};
293
294 $attr->trigger->(
295 $object,
296 (
297 $attr->should_coerce
298 ? $attr->get_read_method_ref->($object)
299 : $params->{$init_arg}
300 ),
301 );
302 }
303}
304
305
# spent 2µs within Moose::Meta::Class::_generate_fallback_constructor which was called: # once (2µs+0s) by Class::MOP::Class::_inline_fallback_constructor at line 554 of Class/MOP/Class.pm
sub _generate_fallback_constructor {
3061300ns my $self = shift;
3071300ns my ($class) = @_;
30812µs return $class . '->Moose::Object::new(@_)'
309}
310
311
# spent 189µs (14+175) within Moose::Meta::Class::_inline_params which was called: # once (14µs+175µs) by Class::MOP::Class::_inline_new_object at line 538 of Class/MOP/Class.pm
sub _inline_params {
3121200ns my $self = shift;
3131300ns my ($params, $class) = @_;
314 return (
315114µs1175µs 'my ' . $params . ' = ',
# spent 175µs making 1 call to Moose::Meta::Class::_inline_BUILDARGS
316 $self->_inline_BUILDARGS($class, '@_'),
317 ';',
318 );
319}
320
321
# spent 175µs (18+157) within Moose::Meta::Class::_inline_BUILDARGS which was called: # once (18µs+157µs) by Moose::Meta::Class::_inline_params at line 315
sub _inline_BUILDARGS {
3221200ns my $self = shift;
3231400ns my ($class, $args) = @_;
324
32512µs1152µs my $buildargs = $self->find_method_by_name("BUILDARGS");
# spent 152µs making 1 call to Class::MOP::Class::find_method_by_name
326
327112µs35µs if ($args eq '@_'
# spent 4µs making 1 call to Moose::Meta::Class::_inline_throw_exception # spent 1µs making 1 call to Class::MOP::Method::__ANON__[Class/MOP/Method.pm:16] # spent 200ns making 1 call to Class::MOP::Method::body
328 && (!$buildargs or $buildargs->body == \&Moose::Object::BUILDARGS)) {
329 return (
330 'do {',
331 'my $params;',
332 'if (scalar @_ == 1) {',
333 'if (!defined($_[0]) || ref($_[0]) ne \'HASH\') {',
334 $self->_inline_throw_exception(
335 'SingleParamsToNewMustBeHashRef'
336 ) . ';',
337 '}',
338 '$params = { %{ $_[0] } };',
339 '}',
340 'elsif (@_ % 2) {',
341 'Carp::carp(',
342 '"The new() method for ' . $class . ' expects a '
343 . 'hash reference or a key/value list. You passed an '
344 . 'odd number of arguments"',
345 ');',
346 '$params = {@_, undef};',
347 '}',
348 'else {',
349 '$params = {@_};',
350 '}',
351 '$params;',
352 '}',
353 );
354 }
355 else {
356 return $class . '->BUILDARGS(' . $args . ')';
357 }
358}
359
360
# spent 711µs (20+690) within Moose::Meta::Class::_inline_slot_initializer which was called 4 times, avg 178µs/call: # 4 times (20µs+690µs) by Class::MOP::Class::_inline_slot_initializers at line 592 of Class/MOP/Class.pm, avg 178µs/call
sub _inline_slot_initializer {
3614600ns my $self = shift;
3624600ns my ($attr, $idx) = @_;
363
364 return (
365418µs12690µs '## ' . $attr->name,
# spent 650µs making 4 calls to Class::MOP::Class::_inline_slot_initializer, avg 162µs/call # spent 40µs making 4 calls to Moose::Meta::Class::_inline_check_required_attr, avg 10µs/call # spent 900ns making 4 calls to Class::MOP::Mixin::AttributeCore::name, avg 225ns/call
366 $self->_inline_check_required_attr($attr),
367 $self->SUPER::_inline_slot_initializer(@_),
368 );
369}
370
371
# spent 40µs (32+8) within Moose::Meta::Class::_inline_check_required_attr which was called 4 times, avg 10µs/call: # 4 times (32µs+8µs) by Moose::Meta::Class::_inline_slot_initializer at line 365, avg 10µs/call
sub _inline_check_required_attr {
3724700ns my $self = shift;
3734900ns my ($attr) = @_;
374
37547µs4900ns return unless defined $attr->init_arg;
# spent 900ns making 4 calls to Class::MOP::Mixin::AttributeCore::init_arg, avg 225ns/call
376412µs84µs return unless $attr->can('is_required') && $attr->is_required;
# spent 2µs making 4 calls to Moose::Meta::Mixin::AttributeCore::is_required, avg 600ns/call # spent 1µs making 4 calls to UNIVERSAL::can, avg 350ns/call
37713µs21µs return if $attr->has_default || $attr->has_builder;
# spent 900ns making 1 call to Class::MOP::Mixin::AttributeCore::has_builder # spent 500ns making 1 call to Class::MOP::Mixin::AttributeCore::has_default
378
379 return (
38018µs32µs 'if (!exists $params->{\'' . $attr->init_arg . '\'}) {',
# spent 2µs making 1 call to Moose::Meta::Class::_inline_throw_exception # spent 200ns making 1 call to Class::MOP::Mixin::AttributeCore::init_arg # spent 200ns making 1 call to Class::MOP::Mixin::AttributeCore::name
381 $self->_inline_throw_exception(
382 AttributeIsRequired =>
383 'params => $params, '.
384 'class_name => $class_name, '.
385 'attribute_name => "'.quotemeta($attr->name).'"'
386 ).';',
387 '}',
388 );
389}
390
391# XXX: these two are duplicated from cmop, because we have to pass the tc stuff
392# through to _inline_set_value - this should probably be fixed, but i'm not
393# quite sure how. -doy
394
# spent 359µs (26+332) within Moose::Meta::Class::_inline_init_attr_from_constructor which was called 4 times, avg 90µs/call: # 4 times (26µs+332µs) by Class::MOP::Class::_inline_slot_initializer at line 601 of Class/MOP/Class.pm, avg 90µs/call
sub _inline_init_attr_from_constructor {
3954600ns my $self = shift;
3964700ns my ($attr, $idx) = @_;
397
398414µs8331µs my @initial_value = $attr->_inline_set_value(
# spent 330µs making 4 calls to Moose::Meta::Attribute::_inline_set_value, avg 82µs/call # spent 600ns making 4 calls to Class::MOP::Mixin::AttributeCore::init_arg, avg 150ns/call
399 '$instance',
400 '$params->{\'' . $attr->init_arg . '\'}',
401 '$type_constraint_bodies[' . $idx . ']',
402 '$type_coercions[' . $idx . ']',
403 '$type_constraint_messages[' . $idx . ']',
404 'for constructor',
405 );
406
40743µs42µs push @initial_value, (
# spent 2µs making 4 calls to Class::MOP::Mixin::AttributeCore::has_initializer, avg 475ns/call
408 '$attrs->[' . $idx . ']->set_initial_value(',
409 '$instance,',
410 $attr->_inline_instance_get('$instance'),
411 ');',
412 ) if $attr->has_initializer;
413
41447µs return @initial_value;
415}
416
417
# spent 251µs (34+217) within Moose::Meta::Class::_inline_init_attr_from_default which was called 4 times, avg 63µs/call: # 4 times (34µs+217µs) by Class::MOP::Class::_inline_slot_initializer at line 606 of Class/MOP/Class.pm, avg 63µs/call
sub _inline_init_attr_from_default {
4184600ns my $self = shift;
4194800ns my ($attr, $idx) = @_;
420
421437µs828µs return if $attr->can('is_lazy') && $attr->is_lazy;
# spent 26µs making 4 calls to UNIVERSAL::can, avg 7µs/call # spent 2µs making 4 calls to Moose::Meta::Mixin::AttributeCore::is_lazy, avg 575ns/call
42234µs315µs my $default = $self->_inline_default_value($attr, $idx);
# spent 15µs making 3 calls to Class::MOP::Class::_inline_default_value, avg 5µs/call
42333µs return unless $default;
424
42526µs2172µs my @initial_value = (
# spent 172µs making 2 calls to Moose::Meta::Attribute::_inline_set_value, avg 86µs/call
426 'my $default = ' . $default . ';',
427 $attr->_inline_set_value(
428 '$instance',
429 '$default',
430 '$type_constraint_bodies[' . $idx . ']',
431 '$type_coercions[' . $idx . ']',
432 '$type_constraint_messages[' . $idx . ']',
433 'for constructor',
434 ),
435 );
436
43721µs21µs push @initial_value, (
# spent 1µs making 2 calls to Class::MOP::Mixin::AttributeCore::has_initializer, avg 500ns/call
438 '$attrs->[' . $idx . ']->set_initial_value(',
439 '$instance,',
440 $attr->_inline_instance_get('$instance'),
441 ');',
442 ) if $attr->has_initializer;
443
44423µs return @initial_value;
445}
446
447
# spent 139µs (6+133) within Moose::Meta::Class::_inline_extra_init which was called: # once (6µs+133µs) by Class::MOP::Class::_inline_new_object at line 538 of Class/MOP/Class.pm
sub _inline_extra_init {
4481400ns my $self = shift;
449 return (
45014µs2133µs $self->_inline_triggers,
# spent 70µs making 1 call to Moose::Meta::Class::_inline_triggers # spent 63µs making 1 call to Moose::Meta::Class::_inline_BUILDALL
451 $self->_inline_BUILDALL,
452 );
453}
454
455
# spent 70µs (28+42) within Moose::Meta::Class::_inline_triggers which was called: # once (28µs+42µs) by Moose::Meta::Class::_inline_extra_init at line 450
sub _inline_triggers {
4561200ns my $self = shift;
4571200ns my @trigger_calls;
458
459616µs1231µs my @attrs = sort { $a->name cmp $b->name } $self->get_all_attributes;
# spent 17µs making 1 call to Class::MOP::Class::get_all_attributes # spent 12µs making 1 call to Moose::Meta::Class::CORE:sort # spent 1µs making 10 calls to Class::MOP::Mixin::AttributeCore::name, avg 140ns/call
46012µs for my $i (0 .. $#attrs) {
4614800ns my $attr = $attrs[$i];
462
46348µs83µs next unless $attr->can('has_trigger') && $attr->has_trigger;
# spent 2µs making 4 calls to Moose::Meta::Mixin::AttributeCore::has_trigger, avg 400ns/call # spent 1µs making 4 calls to UNIVERSAL::can, avg 275ns/call
464
46513µs1300ns my $init_arg = $attr->init_arg;
# spent 300ns making 1 call to Class::MOP::Mixin::AttributeCore::init_arg
4661300ns next unless defined $init_arg;
467
46814µs19µs push @trigger_calls,
# spent 9µs making 1 call to Class::MOP::Attribute::_inline_instance_get
469 'if (exists $params->{\'' . $init_arg . '\'}) {',
470 '$triggers->[' . $i . ']->(',
471 '$instance,',
472 $attr->_inline_instance_get('$instance') . ',',
473 ');',
474 '}';
475 }
476
47713µs return @trigger_calls;
478}
479
480
# spent 63µs (6+56) within Moose::Meta::Class::_inline_BUILDALL which was called: # once (6µs+56µs) by Moose::Meta::Class::_inline_extra_init at line 450
sub _inline_BUILDALL {
4811300ns my $self = shift;
482
48314µs156µs my @methods = reverse $self->find_all_methods_by_name('BUILD');
# spent 56µs making 1 call to Class::MOP::Class::find_all_methods_by_name
4841200ns my @BUILD_calls;
485
4861800ns foreach my $method (@methods) {
487 push @BUILD_calls,
488 '$instance->' . $method->{class} . '::BUILD($params);';
489 }
490
49112µs return @BUILD_calls;
492}
493
494
# spent 210µs (77+133) within Moose::Meta::Class::_eval_environment which was called: # once (77µs+133µs) by Class::MOP::Method::Constructor::_eval_environment at line 86 of Class/MOP/Method/Constructor.pm
sub _eval_environment {
4951300ns my $self = shift;
496
497513µs1027µs my @attrs = sort { $a->name cmp $b->name } $self->get_all_attributes;
# spent 16µs making 1 call to Class::MOP::Class::get_all_attributes # spent 10µs making 1 call to Moose::Meta::Class::CORE:sort # spent 1µs making 8 calls to Class::MOP::Mixin::AttributeCore::name, avg 150ns/call
498
499 my $triggers = [
500510µs94µs map { $_->can('has_trigger') && $_->has_trigger ? $_->trigger : undef }
# spent 2µs making 4 calls to Moose::Meta::Mixin::AttributeCore::has_trigger, avg 375ns/call # spent 2µs making 1 call to Moose::Meta::Mixin::AttributeCore::trigger # spent 1µs making 4 calls to UNIVERSAL::can, avg 250ns/call
501 @attrs
502 ];
503
504 # We need to check if the attribute ->can('type_constraint')
505 # since we may be trying to immutabilize a Moose meta class,
506 # which in turn has attributes which are Class::MOP::Attribute
507 # objects, rather than Moose::Meta::Attribute. And
508 # Class::MOP::Attribute attributes have no type constraints.
509 # However we need to make sure we leave an undef value there
510 # because the inlined code is using the index of the attributes
511 # to determine where to find the type constraint
512
513 my @type_constraints = map {
51458µs83µs $_->can('type_constraint') ? $_->type_constraint : undef
# spent 2µs making 4 calls to Moose::Meta::Mixin::AttributeCore::type_constraint, avg 425ns/call # spent 900ns making 4 calls to UNIVERSAL::can, avg 225ns/call
515 } @attrs;
516
517 my @type_constraint_bodies = map {
51855µs42µs defined $_ ? $_->_compiled_type_constraint : undef;
# spent 2µs making 4 calls to Moose::Meta::TypeConstraint::_compiled_type_constraint, avg 625ns/call
519 } @type_constraints;
520
521 my @type_coercions = map {
52254µs41µs defined $_ && $_->has_coercion
# spent 1µs making 4 calls to Moose::Meta::TypeConstraint::has_coercion, avg 350ns/call
523 ? $_->coercion->_compiled_type_coercion
524 : undef
525 } @type_constraints;
526
527 my @type_constraint_messages = map {
52856µs84µs defined $_
# spent 2µs making 4 calls to Moose::Meta::TypeConstraint::_default_message, avg 525ns/call # spent 2µs making 4 calls to Moose::Meta::TypeConstraint::has_message, avg 375ns/call
529 ? ($_->has_message ? $_->message : $_->_default_message)
530 : undef
531 } @type_constraints;
532
533 return {
534 %{ $self->SUPER::_eval_environment },
53548µs42µs ((any { defined && $_->has_initializer } @attrs)
# spent 2µs making 4 calls to Class::MOP::Mixin::AttributeCore::has_initializer, avg 375ns/call
536 ? ('$attrs' => \[@attrs])
537 : ()),
538 '$triggers' => \$triggers,
539 '@type_coercions' => \@type_coercions,
540 '@type_constraint_bodies' => \@type_constraint_bodies,
541 '@type_constraint_messages' => \@type_constraint_messages,
542916µs793µs ( map { defined($_) ? %{ $_->inline_environment } : () }
# spent 36µs making 1 call to Class::MOP::Class::_eval_environment # spent 33µs making 1 call to Moose::Meta::TypeConstraint::Parameterized::inline_environment # spent 14µs making 3 calls to Moose::Meta::TypeConstraint::inline_environment, avg 5µs/call # spent 9µs making 1 call to List::Util::any # spent 300ns making 1 call to Class::MOP::Package::name
543 @type_constraints ),
544 # pretty sure this is only going to be closed over if you use a custom
545 # error class at this point, but we should still get rid of this
546 # at some point
547 '$meta' => \$self,
548 '$class_name' => \($self->name),
549 };
550}
551
552
# spent 577µs (40+538) within Moose::Meta::Class::superclasses which was called 6 times, avg 96µs/call: # 3 times (19µs+57µs) by Class::MOP::Class::_check_metaclass_compatibility at line 197 of Class/MOP/Class.pm, avg 25µs/call # 2 times (17µs+485µs) by Moose::init_meta at line 225 of Moose.pm, avg 251µs/call # once (3µs+-3µs) by Class::MOP::Class::_superclasses_updated at line 979 of Class/MOP/Class.pm
sub superclasses {
55361µs my $self = shift;
55466µs648µs my $supers = Data::OptList::mkopt(\@_);
# spent 48µs making 6 calls to Data::OptList::mkopt, avg 8µs/call
55564µs foreach my $super (@{ $supers }) {
5561900ns my ($name, $opts) = @{ $super };
55712µs145µs Moose::Util::_load_user_class($name, $opts);
# spent 45µs making 1 call to Moose::Util::_load_user_class
55811µs15µs my $meta = Class::MOP::class_of($name);
# spent 5µs making 1 call to Class::MOP::class_of
55915µs12µs throw_exception( CanExtendOnlyClasses => role_name => $meta->name )
# spent 2µs making 1 call to UNIVERSAL::isa
560 if $meta && $meta->isa('Moose::Meta::Role')
561 }
562617µs6464µs return $self->SUPER::superclasses(map { $_->[0] } @{ $supers });
# spent 477µs making 6 calls to Class::MOP::Class::superclasses, avg 80µs/call, recursion: max depth 1, sum of overlapping time 14µs
563}
564
565### ---------------------------------------------
566
567
# spent 13.1ms (60µs+13.0) within Moose::Meta::Class::add_attribute which was called 4 times, avg 3.27ms/call: # 4 times (60µs+13.0ms) by Moose::has at line 76 of Moose.pm, avg 3.27ms/call
sub add_attribute {
56841µs my $self = shift;
569422µs84.21ms my $attr =
# spent 4.21ms making 4 calls to Moose::Meta::Class::_process_attribute, avg 1.05ms/call # spent 1µs making 4 calls to Scalar::Util::blessed, avg 250ns/call
570 (blessed $_[0] && $_[0]->isa('Class::MOP::Attribute')
571 ? $_[0]
572 : $self->_process_attribute(@_));
573410µs48.79ms $self->SUPER::add_attribute($attr);
# spent 8.79ms making 4 calls to Class::MOP::Mixin::HasAttributes::add_attribute, avg 2.20ms/call
574 # it may be a Class::MOP::Attribute, theoretically, which doesn't have
575 # 'bare' and doesn't implement this method
576414µs817µs if ($attr->can('_check_associated_methods')) {
# spent 13µs making 4 calls to Moose::Meta::Attribute::_check_associated_methods, avg 3µs/call # spent 3µs making 4 calls to UNIVERSAL::can, avg 825ns/call
577 $attr->_check_associated_methods;
578 }
57946µs return $attr;
580}
581
582sub add_override_method_modifier {
583 my ($self, $name, $method, $_super_package) = @_;
584
585 my $existing_method = $self->get_method($name);
586 (!$existing_method)
587 || throw_exception( CannotOverrideLocalMethodIsPresent => class_name => $self->name,
588 method => $existing_method,
589 );
590 $self->add_method($name => Moose::Meta::Method::Overridden->new(
591 method => $method,
592 class => $self,
593 package => $_super_package, # need this for roles
594 name => $name,
595 ));
596}
597
598sub add_augment_method_modifier {
599 my ($self, $name, $method) = @_;
600 my $existing_method = $self->get_method($name);
601 throw_exception( CannotAugmentIfLocalMethodPresent => class_name => $self->name,
602 method => $existing_method,
603 )
604 if( $existing_method );
605
606 $self->add_method($name => Moose::Meta::Method::Augmented->new(
607 method => $method,
608 class => $self,
609 name => $name,
610 ));
611}
612
613## Private Utility methods ...
614
615sub _find_next_method_by_name_which_is_not_overridden {
616 my ($self, $name) = @_;
617 foreach my $method ($self->find_all_methods_by_name($name)) {
618 return $method->{code}
619 if blessed($method->{code}) && !$method->{code}->isa('Moose::Meta::Method::Overridden');
620 }
621 return undef;
622}
623
624## Metaclass compatibility
625
626
# spent 34µs (25+9) within Moose::Meta::Class::_base_metaclasses which was called 2 times, avg 17µs/call: # once (16µs+5µs) by Class::MOP::Class::_can_fix_metaclass_incompatibility at line 324 of Class/MOP/Class.pm # once (9µs+4µs) by Class::MOP::Class::_check_metaclass_compatibility at line 202 of Class/MOP/Class.pm
sub _base_metaclasses {
6272300ns my $self = shift;
62825µs23µs my %metaclasses = $self->SUPER::_base_metaclasses;
# spent 3µs making 2 calls to Class::MOP::Class::_base_metaclasses, avg 1µs/call
62922µs for my $class (keys %metaclasses) {
6301220µs126µs $metaclasses{$class} =~ s/^Class::MOP/Moose::Meta/;
# spent 6µs making 12 calls to Moose::Meta::Class::CORE:subst, avg 542ns/call
631 }
632 return (
63325µs %metaclasses,
634 );
635}
636
637sub _fix_class_metaclass_incompatibility {
638 my $self = shift;
639 my ($super_meta) = @_;
640
641 $self->SUPER::_fix_class_metaclass_incompatibility(@_);
642
643 if ($self->_class_metaclass_can_be_made_compatible($super_meta)) {
644 ($self->is_pristine)
645 || throw_exception( CannotFixMetaclassCompatibility => class => $self,
646 superclass => $super_meta
647 );
648 my $super_meta_name = $super_meta->_real_ref_name;
649 my $class_meta_subclass_meta_name = Moose::Util::_reconcile_roles_for_metaclass(blessed($self), $super_meta_name);
650 my $new_self = $class_meta_subclass_meta_name->reinitialize(
651 $self->name,
652 );
653
654 $self->_replace_self( $new_self, $class_meta_subclass_meta_name );
655 }
656}
657
658sub _fix_single_metaclass_incompatibility {
659 my $self = shift;
660 my ($metaclass_type, $super_meta) = @_;
661
662 $self->SUPER::_fix_single_metaclass_incompatibility(@_);
663
664 if ($self->_single_metaclass_can_be_made_compatible($super_meta, $metaclass_type)) {
665 ($self->is_pristine)
666 || throw_exception( CannotFixMetaclassCompatibility => class => $self,
667 superclass => $super_meta,
668 metaclass_type => $metaclass_type
669 );
670 my $super_meta_name = $super_meta->_real_ref_name;
671 my $class_specific_meta_subclass_meta_name = Moose::Util::_reconcile_roles_for_metaclass($self->$metaclass_type, $super_meta->$metaclass_type);
672 my $new_self = $super_meta->reinitialize(
673 $self->name,
674 $metaclass_type => $class_specific_meta_subclass_meta_name,
675 );
676
677 $self->_replace_self( $new_self, $super_meta_name );
678 }
679}
680
681sub _replace_self {
682 my $self = shift;
683 my ( $new_self, $new_class) = @_;
684
685 %$self = %$new_self;
686 bless $self, $new_class;
687
688 # We need to replace the cached metaclass instance or else when it goes
689 # out of scope Class::MOP::Class destroy's the namespace for the
690 # metaclass's class, causing much havoc.
691 my $weaken = Class::MOP::metaclass_is_weak( $self->name );
692 Class::MOP::store_metaclass_by_name( $self->name, $self );
693 Class::MOP::weaken_metaclass( $self->name ) if $weaken;
694}
695
696
# spent 4.21ms (27µs+4.18) within Moose::Meta::Class::_process_attribute which was called 4 times, avg 1.05ms/call: # 4 times (27µs+4.18ms) by Moose::Meta::Class::add_attribute at line 569, avg 1.05ms/call
sub _process_attribute {
69744µs my ( $self, $name, @args ) = @_;
698
69942µs @args = %{$args[0]} if scalar @args == 1 && ref($args[0]) eq 'HASH';
700
70149µs42µs if (($name || '') =~ /^\+(.*)/) {
# spent 2µs making 4 calls to Moose::Meta::Class::CORE:match, avg 550ns/call
702 return $self->_process_inherited_attribute($1, @args);
703 }
704 else {
705412µs44.18ms return $self->_process_new_attribute($name, @args);
# spent 4.18ms making 4 calls to Moose::Meta::Class::_process_new_attribute, avg 1.04ms/call
706 }
707}
708
709
# spent 4.18ms (25µs+4.15) within Moose::Meta::Class::_process_new_attribute which was called 4 times, avg 1.04ms/call: # 4 times (25µs+4.15ms) by Moose::Meta::Class::_process_attribute at line 705, avg 1.04ms/call
sub _process_new_attribute {
71043µs my ( $self, $name, @args ) = @_;
711
712431µs84.15ms $self->attribute_metaclass->interpolate_class_and_new($name, @args);
# spent 4.15ms making 4 calls to Moose::Meta::Attribute::interpolate_class_and_new, avg 1.04ms/call # spent 2µs making 4 calls to Class::MOP::Mixin::HasAttributes::attribute_metaclass, avg 600ns/call
713}
714
715sub _process_inherited_attribute {
716 my ($self, $attr_name, %options) = @_;
717
718 my $inherited_attr = $self->find_attribute_by_name($attr_name);
719 (defined $inherited_attr)
720 || throw_exception( NoAttributeFoundInSuperClass => class_name => $self->name,
721 attribute_name => $attr_name,
722 params => \%options
723 );
724 if ($inherited_attr->isa('Moose::Meta::Attribute')) {
725 return $inherited_attr->clone_and_inherit_options(%options);
726 }
727 else {
728 # NOTE:
729 # kind of a kludge to handle Class::MOP::Attributes
730 return $inherited_attr->Moose::Meta::Attribute::clone_and_inherit_options(%options);
731 }
732}
733
734# reinitialization support
735
736sub _restore_metaobjects_from {
737 my $self = shift;
738 my ($old_meta) = @_;
739
740 $self->SUPER::_restore_metaobjects_from($old_meta);
741
742 for my $role ( @{ $old_meta->roles } ) {
743 $self->add_role($role);
744 }
745
746 for my $application ( @{ $old_meta->_get_role_applications } ) {
747 $application->class($self);
748 $self->add_role_application ($application);
749 }
750}
751
752## Immutability
753
754
# spent 25µs (6+19) within Moose::Meta::Class::_immutable_options which was called: # once (6µs+19µs) by Class::MOP::Class::make_immutable at line 1297 of Class/MOP/Class.pm
sub _immutable_options {
7551300ns my ( $self, @args ) = @_;
756
75715µs119µs $self->SUPER::_immutable_options(
# spent 19µs making 1 call to Class::MOP::Class::_immutable_options
758 inline_destructor => 1,
759
760 # Moose always does this when an attribute is created
761 inline_accessors => 0,
762
763 @args,
764 );
765}
766
767sub _fixup_attributes_after_rebless {
768 my $self = shift;
769 my ($instance, $rebless_from, %params) = @_;
770
771 $self->SUPER::_fixup_attributes_after_rebless(
772 $instance,
773 $rebless_from,
774 %params
775 );
776
777 $self->_call_all_triggers( $instance, \%params );
778}
779
780## -------------------------------------------------
781
782our $error_level;
783
784
# spent 5µs within Moose::Meta::Class::_inline_throw_exception which was called 2 times, avg 3µs/call: # once (4µs+0s) by Moose::Meta::Class::_inline_BUILDARGS at line 327 # once (2µs+0s) by Moose::Meta::Class::_inline_check_required_attr at line 380
sub _inline_throw_exception {
78522µs my ( $self, $exception_type, $throw_args ) = @_;
78625µs return 'die Module::Runtime::use_module("Moose::Exception::' . $exception_type . '")->new(' . ($throw_args || '') . ')';
787}
788
78919µs1;
790
791# ABSTRACT: The Moose metaclass
792
793__END__
 
# spent 2µs within Moose::Meta::Class::CORE:match which was called 4 times, avg 550ns/call: # 4 times (2µs+0s) by Moose::Meta::Class::_process_attribute at line 701, avg 550ns/call
sub Moose::Meta::Class::CORE:match; # opcode
# spent 22µs (19+3) within Moose::Meta::Class::CORE:sort which was called 2 times, avg 11µs/call: # once (11µs+1µs) by Moose::Meta::Class::_inline_triggers at line 459 # once (8µs+1µs) by Moose::Meta::Class::_eval_environment at line 497
sub Moose::Meta::Class::CORE:sort; # opcode
# spent 6µs within Moose::Meta::Class::CORE:subst which was called 12 times, avg 542ns/call: # 12 times (6µs+0s) by Moose::Meta::Class::_base_metaclasses at line 630, avg 542ns/call
sub Moose::Meta::Class::CORE:subst; # opcode