Filename | /Users/ap13/perl5/lib/perl5/Class/Data/Inheritable.pm |
Statements | Executed 48 statements in 260µs |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
5 | 5 | 1 | 41µs | 41µs | mk_classdata | Class::Data::Inheritable::
1 | 1 | 1 | 15µs | 26µs | BEGIN@3 | Class::Data::Inheritable::
1 | 1 | 1 | 8µs | 34µs | BEGIN@4 | Class::Data::Inheritable::
3 | 3 | 1 | 7µs | 7µs | __ANON__[:23] | Class::Data::Inheritable::
Line | State ments |
Time on line |
Calls | Time in subs |
Code |
---|---|---|---|---|---|
1 | package Class::Data::Inheritable; | ||||
2 | |||||
3 | 2 | 26µs | 2 | 36µs | # spent 26µs (15+11) within Class::Data::Inheritable::BEGIN@3 which was called:
# once (15µs+11µs) by Exception::Class::Base::BEGIN@6 at line 3 # spent 26µs making 1 call to Class::Data::Inheritable::BEGIN@3
# spent 11µs making 1 call to strict::import |
4 | 2 | 170µs | 2 | 60µs | # spent 34µs (8+26) within Class::Data::Inheritable::BEGIN@4 which was called:
# once (8µs+26µs) by Exception::Class::Base::BEGIN@6 at line 4 # spent 34µs making 1 call to Class::Data::Inheritable::BEGIN@4
# spent 26µs making 1 call to vars::import |
5 | 1 | 700ns | $VERSION = '0.08'; | ||
6 | |||||
7 | # spent 41µs within Class::Data::Inheritable::mk_classdata which was called 5 times, avg 8µs/call:
# once (11µs+0s) by Exception::Class::Base::BEGIN@12 at line 19 of Exception/Class/Base.pm
# once (9µs+0s) by Exception::Class::Base::BEGIN@12 at line 13 of Exception/Class/Base.pm
# once (8µs+0s) by Exception::Class::Base::BEGIN@12 at line 14 of Exception/Class/Base.pm
# once (6µs+0s) by Exception::Class::Base::BEGIN@12 at line 16 of Exception/Class/Base.pm
# once (6µs+0s) by Exception::Class::Base::BEGIN@12 at line 22 of Exception/Class/Base.pm | ||||
8 | 30 | 49µs | my ($declaredclass, $attribute, $data) = @_; | ||
9 | |||||
10 | if( ref $declaredclass ) { | ||||
11 | require Carp; | ||||
12 | Carp::croak("mk_classdata() is a class method, not an object method"); | ||||
13 | } | ||||
14 | |||||
15 | # spent 7µs within Class::Data::Inheritable::__ANON__[/Users/ap13/perl5/lib/perl5/Class/Data/Inheritable.pm:23] which was called 3 times, avg 2µs/call:
# once (3µs+0s) by Exception::Class::Base::BEGIN@12 at line 17 of Exception/Class/Base.pm
# once (2µs+0s) by Exception::Class::Base::BEGIN@12 at line 20 of Exception/Class/Base.pm
# once (2µs+0s) by Exception::Class::Base::BEGIN@12 at line 23 of Exception/Class/Base.pm | ||||
16 | 12 | 12µs | my $wantclass = ref($_[0]) || $_[0]; | ||
17 | |||||
18 | return $wantclass->mk_classdata($attribute)->(@_) | ||||
19 | if @_>1 && $wantclass ne $declaredclass; | ||||
20 | |||||
21 | $data = $_[1] if @_>1; | ||||
22 | return $data; | ||||
23 | }; | ||||
24 | |||||
25 | my $alias = "_${attribute}_accessor"; | ||||
26 | *{$declaredclass.'::'.$attribute} = $accessor; | ||||
27 | *{$declaredclass.'::'.$alias} = $accessor; | ||||
28 | } | ||||
29 | |||||
30 | 1 | 3µs | 1; | ||
31 | |||||
32 | __END__ |