Filename | /usr/local/lib/perl/5.14.2/Class/MOP/Mixin/AttributeCore.pm |
Statements | Executed 6157 statements in 9.74ms |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
588 | 4 | 3 | 1.28ms | 1.66ms | default | Class::MOP::Mixin::AttributeCore::
323 | 3 | 3 | 567µs | 567µs | is_default_a_coderef | Class::MOP::Mixin::AttributeCore::
36 | 1 | 1 | 107µs | 145µs | has_read_method | Class::MOP::Mixin::AttributeCore::
1 | 1 | 1 | 9µs | 9µs | BEGIN@2 | Class::MOP::Mixin::AttributeCore::
1 | 1 | 1 | 8µs | 362µs | BEGIN@14 | Class::MOP::Mixin::AttributeCore::
1 | 1 | 1 | 7µs | 11µs | BEGIN@10 | Class::MOP::Mixin::AttributeCore::
1 | 1 | 1 | 7µs | 10µs | BEGIN@9 | 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 9µs within Class::MOP::Mixin::AttributeCore::BEGIN@2 which was called:
# once (9µ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 | 9µs | } # spent 9µ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+4) within Class::MOP::Mixin::AttributeCore::BEGIN@10 which was called:
# once (7µs+4µs) by Class::MOP::BEGIN@23 at line 10 # spent 11µs making 1 call to Class::MOP::Mixin::AttributeCore::BEGIN@10
# spent 4µs making 1 call to warnings::import |
11 | |||||
12 | 2 | 24µs | 2 | 63µs | # spent 35µs (6+28) within Class::MOP::Mixin::AttributeCore::BEGIN@12 which was called:
# once (6µs+28µs) by Class::MOP::BEGIN@23 at line 12 # spent 35µs making 1 call to Class::MOP::Mixin::AttributeCore::BEGIN@12
# spent 28µs making 1 call to Exporter::import |
13 | |||||
14 | 2 | 332µs | 2 | 716µs | # spent 362µs (8+354) within Class::MOP::Mixin::AttributeCore::BEGIN@14 which was called:
# once (8µs+354µs) by Class::MOP::BEGIN@23 at line 14 # spent 362µs making 1 call to Class::MOP::Mixin::AttributeCore::BEGIN@14
# spent 354µs making 1 call to base::import |
15 | |||||
16 | 257 | 577µs | sub has_accessor { defined $_[0]->{'accessor'} } | ||
17 | 293 | 586µs | sub has_reader { defined $_[0]->{'reader'} } | ||
18 | 257 | 490µs | sub has_writer { defined $_[0]->{'writer'} } | ||
19 | 257 | 483µs | sub has_predicate { defined $_[0]->{'predicate'} } | ||
20 | 257 | 469µs | sub has_clearer { defined $_[0]->{'clearer'} } | ||
21 | 216 | 404µ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.67ms | sub has_initializer { defined $_[0]->{'initializer'} } | ||
25 | sub has_insertion_order { defined $_[0]->{'insertion_order'} } | ||||
26 | |||||
27 | 181 | 390µs | sub _set_insertion_order { $_[0]->{'insertion_order'} = $_[1] } | ||
28 | |||||
29 | 36 | 89µs | 36 | 38µs | # spent 145µs (107+38) within Class::MOP::Mixin::AttributeCore::has_read_method which was called 36 times, avg 4µs/call:
# 36 times (107µs+38µs) by Moose::Meta::Method::Delegation::_get_delegate_accessor at line 127 of Moose/Meta/Method/Delegation.pm, avg 4µs/call # spent 38µ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 567µs within Class::MOP::Mixin::AttributeCore::is_default_a_coderef which was called 323 times, avg 2µs/call:
# 170 times (260µs+0s) by Class::MOP::Mixin::AttributeCore::default at line 45, avg 2µs/call
# 124 times (231µ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 | 905µ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.66ms (1.28+388µs) within Class::MOP::Mixin::AttributeCore::default which was called 588 times, avg 3µs/call:
# 327 times (408µs+0s) by Class::MOP::Class::_eval_environment at line 710 of Class/MOP/Class.pm, avg 1µs/call
# 170 times (706µs+388µs) by Class::MOP::Attribute::initialize_instance_slot at line 125 of Class/MOP/Attribute.pm, avg 6µs/call
# 59 times (105µs+0s) by Class::MOP::Class::_immutable_metaclass at line 1335 of Class/MOP/Class.pm, avg 2µs/call
# 32 times (56µs+0s) by Moose::Meta::Attribute::_eval_environment at line 783 of Moose/Meta/Attribute.pm, avg 2µs/call | ||||
44 | 1764 | 1.44ms | my ( $self, $instance ) = @_; | ||
45 | 170 | 260µs | if ( defined $instance && $self->is_default_a_coderef ) { # spent 260µs making 170 calls to Class::MOP::Mixin::AttributeCore::is_default_a_coderef, avg 2µ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 | 128µs | return $self->{'default'}->($instance); # spent 29µs making 12 calls to Moose::Meta::Class::__ANON__[Moose/Meta/Class.pm:43], avg 2µs/call
# spent 16µs making 12 calls to Moose::Meta::Class::__ANON__[Moose/Meta/Class.pm:37], avg 1µs/call
# spent 16µs making 12 calls to Class::MOP::__ANON__[Class/MOP.pm:132], 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:222], avg 1µs/call
# spent 13µs making 12 calls to Class::MOP::__ANON__[Class/MOP.pm:177], avg 1µs/call
# spent 12µs making 12 calls to Class::MOP::__ANON__[Class/MOP.pm:249], avg 992ns/call
# spent 12µs making 12 calls to Class::MOP::__ANON__[Class/MOP.pm:269], avg 992ns/call
# spent 3µ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__ |