Filename | /opt/perl-5.18.1/lib/site_perl/5.18.1/darwin-thread-multi-2level/Class/MOP/Mixin/AttributeCore.pm |
Statements | Executed 3669 statements in 17.1ms |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
371 | 3 | 2 | 697µs | 796µs | default | Class::MOP::Mixin::AttributeCore::
153 | 3 | 3 | 398µs | 398µs | is_default_a_coderef | Class::MOP::Mixin::AttributeCore::
1 | 1 | 1 | 11µs | 11µs | BEGIN@2 | Class::MOP::Mixin::AttributeCore::
1 | 1 | 1 | 9µs | 14µs | BEGIN@10 | Class::MOP::Mixin::AttributeCore::
1 | 1 | 1 | 9µs | 39µs | BEGIN@12 | Class::MOP::Mixin::AttributeCore::
1 | 1 | 1 | 9µs | 24µs | BEGIN@9 | Class::MOP::Mixin::AttributeCore::
1 | 1 | 1 | 9µs | 448µs | BEGIN@14 | Class::MOP::Mixin::AttributeCore::
0 | 0 | 0 | 0s | 0s | has_read_method | 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 11µs within Class::MOP::Mixin::AttributeCore::BEGIN@2 which was called:
# once (11µs+0s) by Class::MOP::BEGIN@23 at line 4 | ||||
3 | 1 | 11µs | $Class::MOP::Mixin::AttributeCore::AUTHORITY = 'cpan:STEVAN'; | ||
4 | 1 | 46µs | 1 | 11µs | } # spent 11µ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 | 31µs | 2 | 40µs | # spent 24µs (9+16) within Class::MOP::Mixin::AttributeCore::BEGIN@9 which was called:
# once (9µs+16µs) by Class::MOP::BEGIN@23 at line 9 # spent 24µs making 1 call to Class::MOP::Mixin::AttributeCore::BEGIN@9
# spent 16µs making 1 call to strict::import |
10 | 2 | 37µs | 2 | 18µs | # spent 14µs (9+5) within Class::MOP::Mixin::AttributeCore::BEGIN@10 which was called:
# once (9µs+5µs) by Class::MOP::BEGIN@23 at line 10 # spent 14µs making 1 call to Class::MOP::Mixin::AttributeCore::BEGIN@10
# spent 5µs making 1 call to warnings::import |
11 | |||||
12 | 2 | 34µs | 2 | 69µs | # spent 39µs (9+30) within Class::MOP::Mixin::AttributeCore::BEGIN@12 which was called:
# once (9µs+30µs) by Class::MOP::BEGIN@23 at line 12 # spent 39µs making 1 call to Class::MOP::Mixin::AttributeCore::BEGIN@12
# spent 30µs making 1 call to Exporter::import |
13 | |||||
14 | 2 | 474µs | 2 | 888µs | # spent 448µs (9+440) within Class::MOP::Mixin::AttributeCore::BEGIN@14 which was called:
# once (9µs+440µs) by Class::MOP::BEGIN@23 at line 14 # spent 448µs making 1 call to Class::MOP::Mixin::AttributeCore::BEGIN@14
# spent 440µs making 1 call to base::import |
15 | |||||
16 | 200 | 539µs | sub has_accessor { defined $_[0]->{'accessor'} } | ||
17 | 200 | 456µs | sub has_reader { defined $_[0]->{'reader'} } | ||
18 | 200 | 5.65ms | sub has_writer { defined $_[0]->{'writer'} } | ||
19 | 200 | 424µs | sub has_predicate { defined $_[0]->{'predicate'} } | ||
20 | 200 | 457µs | sub has_clearer { defined $_[0]->{'clearer'} } | ||
21 | 191 | 393µs | sub has_builder { defined $_[0]->{'builder'} } | ||
22 | sub has_init_arg { defined $_[0]->{'init_arg'} } | ||||
23 | 290 | 703µs | sub has_default { exists $_[0]->{'default'} } | ||
24 | 540 | 6.16ms | sub has_initializer { defined $_[0]->{'initializer'} } | ||
25 | sub has_insertion_order { defined $_[0]->{'insertion_order'} } | ||||
26 | |||||
27 | 124 | 303µs | sub _set_insertion_order { $_[0]->{'insertion_order'} = $_[1] } | ||
28 | |||||
29 | sub has_read_method { $_[0]->has_reader || $_[0]->has_accessor } | ||||
30 | sub has_write_method { $_[0]->has_writer || $_[0]->has_accessor } | ||||
31 | |||||
32 | # spent 398µs within Class::MOP::Mixin::AttributeCore::is_default_a_coderef which was called 153 times, avg 3µs/call:
# 96 times (244µs+0s) by Class::MOP::Class::_inline_default_value at line 667 of Class/MOP/Class.pm, avg 3µs/call
# 30 times (66µs+0s) by Class::MOP::Mixin::AttributeCore::default at line 45, avg 2µs/call
# 27 times (88µ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 | 153 | 134µs | my ($value) = ref $_[0] ? $_[0]->{'default'} : $_[1]->{'default'}; | ||
36 | |||||
37 | 153 | 116µs | return unless ref($value); | ||
38 | |||||
39 | 111 | 304µs | return ref($value) eq 'CODE' | ||
40 | || ( blessed($value) && $value->isa('Class::MOP::Method') ); | ||||
41 | } | ||||
42 | |||||
43 | # spent 796µs (697+99) within Class::MOP::Mixin::AttributeCore::default which was called 371 times, avg 2µs/call:
# 287 times (409µs+0s) by Class::MOP::Class::_eval_environment at line 710 of Class/MOP/Class.pm, avg 1µs/call
# 54 times (114µs+0s) by Class::MOP::Class::_immutable_metaclass at line 1335 of Class/MOP/Class.pm, avg 2µs/call
# 30 times (174µs+99µs) by Class::MOP::Attribute::initialize_instance_slot at line 117 of Class/MOP/Attribute.pm, avg 9µs/call | ||||
44 | 371 | 71µs | my ( $self, $instance ) = @_; | ||
45 | 371 | 122µs | 48 | 99µs | if ( defined $instance && $self->is_default_a_coderef ) { # spent 66µs making 30 calls to Class::MOP::Mixin::AttributeCore::is_default_a_coderef, avg 2µs/call
# spent 5µs making 2 calls to Moose::Meta::Class::__ANON__[Moose/Meta/Class.pm:37], avg 2µs/call
# spent 4µs making 2 calls to Class::MOP::__ANON__[Class/MOP.pm:249], avg 2µs/call
# spent 4µs making 2 calls to Class::MOP::__ANON__[Class/MOP.pm:177], avg 2µs/call
# spent 4µs making 2 calls to Class::MOP::__ANON__[Class/MOP.pm:222], avg 2µs/call
# spent 4µs making 2 calls to Moose::Meta::Class::__ANON__[Moose/Meta/Class.pm:43], avg 2µs/call
# spent 3µs making 2 calls to Class::MOP::__ANON__[Class/MOP.pm:132], avg 2µs/call
# spent 3µs making 2 calls to Class::MOP::__ANON__[Class/MOP.pm:286], avg 2µs/call
# spent 3µs making 2 calls to Class::MOP::__ANON__[Class/MOP.pm:269], avg 2µs/call
# spent 2µs making 1 call to Class::MOP::__ANON__[Class/MOP.pm:478]
# spent 2µs making 1 call to Moose::Meta::TypeConstraint::Registry::__ANON__[Moose/Meta/TypeConstraint/Registry.pm:27] |
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 | return $self->{'default'}->($instance); | ||||
50 | } | ||||
51 | 353 | 678µs | $self->{'default'}; | ||
52 | } | ||||
53 | |||||
54 | 1 | 4µs | 1; | ||
55 | |||||
56 | # ABSTRACT: Core attributes shared by attribute metaclasses | ||||
57 | |||||
58 | __END__ |