Filename | /usr/local/lib/perl/5.14.2/Class/MOP/Mixin/AttributeCore.pm |
Statements | Executed 6157 statements in 9.64ms |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
588 | 4 | 3 | 1.24ms | 1.59ms | default | Class::MOP::Mixin::AttributeCore::
323 | 3 | 3 | 559µs | 559µs | is_default_a_coderef | Class::MOP::Mixin::AttributeCore::
36 | 1 | 1 | 101µs | 144µs | has_read_method | Class::MOP::Mixin::AttributeCore::
1 | 1 | 1 | 8µs | 311µs | BEGIN@14 | Class::MOP::Mixin::AttributeCore::
1 | 1 | 1 | 8µs | 8µs | BEGIN@2 | Class::MOP::Mixin::AttributeCore::
1 | 1 | 1 | 7µs | 10µs | BEGIN@9 | Class::MOP::Mixin::AttributeCore::
1 | 1 | 1 | 7µs | 11µs | BEGIN@10 | Class::MOP::Mixin::AttributeCore::
1 | 1 | 1 | 6µs | 35µs | BEGIN@12 | Class::MOP::Mixin::AttributeCore::
0 | 0 | 0 | 0s | 0s | has_write_method | Class::MOP::Mixin::AttributeCore::
Line | State ments |
Time on line |
Calls | Time in subs |
Code |
---|---|---|---|---|---|
1 | package Class::MOP::Mixin::AttributeCore; | ||||
2 | # spent 8µs within Class::MOP::Mixin::AttributeCore::BEGIN@2 which was called:
# once (8µs+0s) by Class::MOP::BEGIN@23 at line 4 | ||||
3 | 1 | 5µs | $Class::MOP::Mixin::AttributeCore::AUTHORITY = 'cpan:STEVAN'; | ||
4 | 1 | 31µs | 1 | 8µs | } # spent 8µs making 1 call to Class::MOP::Mixin::AttributeCore::BEGIN@2 |
5 | { | ||||
6 | 2 | 1µs | $Class::MOP::Mixin::AttributeCore::VERSION = '2.1005'; | ||
7 | } | ||||
8 | |||||
9 | 2 | 21µs | 2 | 13µs | # spent 10µs (7+3) within Class::MOP::Mixin::AttributeCore::BEGIN@9 which was called:
# once (7µs+3µs) by Class::MOP::BEGIN@23 at line 9 # spent 10µs making 1 call to Class::MOP::Mixin::AttributeCore::BEGIN@9
# spent 3µs making 1 call to strict::import |
10 | 2 | 22µs | 2 | 16µs | # spent 11µs (7+5) within Class::MOP::Mixin::AttributeCore::BEGIN@10 which was called:
# once (7µs+5µs) by Class::MOP::BEGIN@23 at line 10 # spent 11µs making 1 call to Class::MOP::Mixin::AttributeCore::BEGIN@10
# spent 5µs making 1 call to warnings::import |
11 | |||||
12 | 2 | 25µs | 2 | 64µs | # spent 35µs (6+29) within Class::MOP::Mixin::AttributeCore::BEGIN@12 which was called:
# once (6µs+29µs) by Class::MOP::BEGIN@23 at line 12 # spent 35µs making 1 call to Class::MOP::Mixin::AttributeCore::BEGIN@12
# spent 29µs making 1 call to Exporter::import |
13 | |||||
14 | 2 | 334µs | 2 | 614µs | # spent 311µs (8+303) within Class::MOP::Mixin::AttributeCore::BEGIN@14 which was called:
# once (8µs+303µs) by Class::MOP::BEGIN@23 at line 14 # spent 311µs making 1 call to Class::MOP::Mixin::AttributeCore::BEGIN@14
# spent 303µs making 1 call to base::import |
15 | |||||
16 | 257 | 588µs | sub has_accessor { defined $_[0]->{'accessor'} } | ||
17 | 293 | 578µs | sub has_reader { defined $_[0]->{'reader'} } | ||
18 | 257 | 491µs | sub has_writer { defined $_[0]->{'writer'} } | ||
19 | 257 | 493µs | sub has_predicate { defined $_[0]->{'predicate'} } | ||
20 | 257 | 469µs | sub has_clearer { defined $_[0]->{'clearer'} } | ||
21 | 216 | 380µs | sub has_builder { defined $_[0]->{'builder'} } | ||
22 | sub has_init_arg { defined $_[0]->{'init_arg'} } | ||||
23 | 417 | 801µs | sub has_default { exists $_[0]->{'default'} } | ||
24 | 1369 | 2.63ms | sub has_initializer { defined $_[0]->{'initializer'} } | ||
25 | sub has_insertion_order { defined $_[0]->{'insertion_order'} } | ||||
26 | |||||
27 | 181 | 372µs | sub _set_insertion_order { $_[0]->{'insertion_order'} = $_[1] } | ||
28 | |||||
29 | 36 | 90µs | 36 | 43µs | # spent 144µs (101+43) within Class::MOP::Mixin::AttributeCore::has_read_method which was called 36 times, avg 4µs/call:
# 36 times (101µs+43µs) by Moose::Meta::Method::Delegation::_get_delegate_accessor at line 127 of Moose/Meta/Method/Delegation.pm, avg 4µs/call # spent 43µs making 36 calls to Class::MOP::Mixin::AttributeCore::has_reader, avg 1µs/call |
30 | sub has_write_method { $_[0]->has_writer || $_[0]->has_accessor } | ||||
31 | |||||
32 | # spent 559µs within Class::MOP::Mixin::AttributeCore::is_default_a_coderef which was called 323 times, avg 2µs/call:
# 170 times (251µs+0s) by Class::MOP::Mixin::AttributeCore::default at line 45, avg 1µs/call
# 124 times (233µs+0s) by Class::MOP::Class::_inline_default_value at line 674 of Class/MOP/Class.pm, avg 2µs/call
# 29 times (75µs+0s) by Class::MOP::Attribute::new at line 49 of Class/MOP/Attribute.pm, avg 3µs/call | ||||
33 | # Uber hack because it is called from CMOP::Attribute constructor as | ||||
34 | # $class->is_default_a_coderef(\%options) | ||||
35 | 841 | 884µs | my ($value) = ref $_[0] ? $_[0]->{'default'} : $_[1]->{'default'}; | ||
36 | |||||
37 | return unless ref($value); | ||||
38 | |||||
39 | return ref($value) eq 'CODE' | ||||
40 | || ( blessed($value) && $value->isa('Class::MOP::Method') ); | ||||
41 | } | ||||
42 | |||||
43 | # spent 1.59ms (1.24+354µs) within Class::MOP::Mixin::AttributeCore::default which was called 588 times, avg 3µs/call:
# 327 times (395µs+0s) by Class::MOP::Class::_eval_environment at line 710 of Class/MOP/Class.pm, avg 1µs/call
# 170 times (681µs+354µs) by Class::MOP::Attribute::initialize_instance_slot at line 125 of Class/MOP/Attribute.pm, avg 6µs/call
# 59 times (104µs+0s) by Class::MOP::Class::_immutable_metaclass at line 1335 of Class/MOP/Class.pm, avg 2µs/call
# 32 times (58µs+0s) by Moose::Meta::Attribute::_eval_environment at line 783 of Moose/Meta/Attribute.pm, avg 2µs/call | ||||
44 | 1764 | 1.42ms | my ( $self, $instance ) = @_; | ||
45 | 170 | 251µs | if ( defined $instance && $self->is_default_a_coderef ) { # spent 251µs making 170 calls to Class::MOP::Mixin::AttributeCore::is_default_a_coderef, avg 1µs/call | ||
46 | # if the default is a CODE ref, then we pass in the instance and | ||||
47 | # default can return a value based on that instance. Somewhat crude, | ||||
48 | # but works. | ||||
49 | 98 | 103µs | return $self->{'default'}->($instance); # spent 15µs making 12 calls to Moose::Meta::Class::__ANON__[Moose/Meta/Class.pm:37], avg 1µs/call
# spent 15µs making 12 calls to Class::MOP::__ANON__[Class/MOP.pm:286], avg 1µs/call
# spent 13µs making 12 calls to Class::MOP::__ANON__[Class/MOP.pm:132], avg 1µs/call
# spent 13µs making 12 calls to Moose::Meta::Class::__ANON__[Moose/Meta/Class.pm:43], avg 1µs/call
# spent 12µs making 12 calls to Class::MOP::__ANON__[Class/MOP.pm:177], avg 1µs/call
# spent 11µs making 12 calls to Class::MOP::__ANON__[Class/MOP.pm:222], avg 908ns/call
# spent 11µs making 12 calls to Class::MOP::__ANON__[Class/MOP.pm:269], avg 892ns/call
# spent 10µs making 12 calls to Class::MOP::__ANON__[Class/MOP.pm:249], avg 850ns/call
# spent 2µs making 1 call to Class::MOP::__ANON__[Class/MOP.pm:478]
# spent 1µs making 1 call to Moose::Meta::TypeConstraint::Registry::__ANON__[Moose/Meta/TypeConstraint/Registry.pm:27] | ||
50 | } | ||||
51 | $self->{'default'}; | ||||
52 | } | ||||
53 | |||||
54 | 1 | 2µs | 1; | ||
55 | |||||
56 | # ABSTRACT: Core attributes shared by attribute metaclasses | ||||
57 | |||||
58 | __END__ |