Filename | /usr/share/perl5/Moo/HandleMoose/_TypeMap.pm |
Statements | Executed 15 statements in 649µs |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
1 | 1 | 1 | 17µs | 68µs | BEGIN@2 | Moo::HandleMoose::_TypeMap::
1 | 1 | 1 | 14µs | 25µs | BEGIN@20 | Moo::HandleMoose::_TypeMap::
1 | 1 | 1 | 6µs | 6µs | CLEAR | Moo::HandleMoose::_TypeMap::
1 | 1 | 1 | 4µs | 4µs | BEGIN@10 | Moo::HandleMoose::_TypeMap::
1 | 1 | 1 | 3µs | 3µs | TIEHASH | Moo::HandleMoose::_TypeMap::
0 | 0 | 0 | 0s | 0s | CLONE | Moo::HandleMoose::_TypeMap::
0 | 0 | 0 | 0s | 0s | DELETE | Moo::HandleMoose::_TypeMap::
0 | 0 | 0 | 0s | 0s | DESTROY | Moo::HandleMoose::_TypeMap::
0 | 0 | 0 | 0s | 0s | EXISTS | Moo::HandleMoose::_TypeMap::
0 | 0 | 0 | 0s | 0s | FETCH | Moo::HandleMoose::_TypeMap::
0 | 0 | 0 | 0s | 0s | FIRSTKEY | Moo::HandleMoose::_TypeMap::
0 | 0 | 0 | 0s | 0s | NEXTKEY | Moo::HandleMoose::_TypeMap::
0 | 0 | 0 | 0s | 0s | SCALAR | Moo::HandleMoose::_TypeMap::
0 | 0 | 0 | 0s | 0s | STORE | Moo::HandleMoose::_TypeMap::
0 | 0 | 0 | 0s | 0s | _str_to_ref | Moo::HandleMoose::_TypeMap::
Line | State ments |
Time on line |
Calls | Time in subs |
Code |
---|---|---|---|---|---|
1 | package Moo::HandleMoose::_TypeMap; | ||||
2 | 3 | 52µs | 3 | 118µs | # spent 68µs (17+51) within Moo::HandleMoose::_TypeMap::BEGIN@2 which was called:
# once (17µs+51µs) by Moo::BEGIN@4 at line 2 # spent 68µs making 1 call to Moo::HandleMoose::_TypeMap::BEGIN@2
# spent 35µs making 1 call to strictures::import
# spent 15µs making 1 call to strictures::VERSION |
3 | |||||
4 | package | ||||
5 | Moo::HandleMoose; | ||||
6 | 1 | 300ns | our %TYPE_MAP; | ||
7 | |||||
8 | package Moo::HandleMoose::_TypeMap; | ||||
9 | |||||
10 | 2 | 98µs | 1 | 4µs | # spent 4µs within Moo::HandleMoose::_TypeMap::BEGIN@10 which was called:
# once (4µs+0s) by Moo::BEGIN@4 at line 10 # spent 4µs making 1 call to Moo::HandleMoose::_TypeMap::BEGIN@10 |
11 | |||||
12 | 1 | 100ns | our %WEAK_TYPES; | ||
13 | |||||
14 | sub _str_to_ref { | ||||
15 | my $in = shift; | ||||
16 | return $in | ||||
17 | if ref $in; | ||||
18 | |||||
19 | if ($in =~ /(?:^|=)[A-Z]+\(0x([0-9a-zA-Z]+)\)$/) { | ||||
20 | 2 | 467µs | 2 | 36µs | # spent 25µs (14+11) within Moo::HandleMoose::_TypeMap::BEGIN@20 which was called:
# once (14µs+11µs) by Moo::BEGIN@4 at line 20 # spent 25µs making 1 call to Moo::HandleMoose::_TypeMap::BEGIN@20
# spent 11µs making 1 call to warnings::unimport |
21 | require B; | ||||
22 | my $sv = bless \$id, 'B::SV'; | ||||
23 | my $ref = eval { $sv->object_2svref }; | ||||
24 | if (!defined $ref) { | ||||
25 | die <<'END_ERROR'; | ||||
26 | Moo initialization encountered types defined in a parent thread - ensure that | ||||
27 | Moo is require()d before any further thread spawns following a type definition. | ||||
28 | END_ERROR | ||||
29 | } | ||||
30 | return $ref; | ||||
31 | } | ||||
32 | return $in; | ||||
33 | } | ||||
34 | |||||
35 | 1 | 8µs | # spent 3µs within Moo::HandleMoose::_TypeMap::TIEHASH which was called:
# once (3µs+0s) by Moo::BEGIN@4 at line 69 | ||
36 | |||||
37 | sub STORE { | ||||
38 | my ($self, $key, $value) = @_; | ||||
39 | my $type = _str_to_ref($key); | ||||
40 | $WEAK_TYPES{$type} = $type; | ||||
41 | Scalar::Util::weaken($WEAK_TYPES{$type}) | ||||
42 | if ref $type; | ||||
43 | $self->{$key} = $value; | ||||
44 | } | ||||
45 | |||||
46 | sub FETCH { $_[0]->{$_[1]} } | ||||
47 | sub FIRSTKEY { my $a = scalar keys %{$_[0]}; each %{$_[0]} } | ||||
48 | sub NEXTKEY { each %{$_[0]} } | ||||
49 | sub EXISTS { exists $_[0]->{$_[1]} } | ||||
50 | sub DELETE { delete $_[0]->{$_[1]} } | ||||
51 | 1 | 8µs | # spent 6µs within Moo::HandleMoose::_TypeMap::CLEAR which was called:
# once (6µs+0s) by Moo::BEGIN@4 at line 70 | ||
52 | sub SCALAR { scalar %{$_[0]} } | ||||
53 | |||||
54 | sub CLONE { | ||||
55 | my @types = map { | ||||
56 | defined $WEAK_TYPES{$_} ? ($WEAK_TYPES{$_} => $TYPE_MAP{$_}) : () | ||||
57 | } keys %TYPE_MAP; | ||||
58 | %WEAK_TYPES = (); | ||||
59 | %TYPE_MAP = @types; | ||||
60 | } | ||||
61 | |||||
62 | sub DESTROY { | ||||
63 | my %types = %{$_[0]}; | ||||
64 | untie %TYPE_MAP; | ||||
65 | %TYPE_MAP = %types; | ||||
66 | } | ||||
67 | |||||
68 | 1 | 1µs | my @types = %TYPE_MAP; | ||
69 | 1 | 5µs | 1 | 3µs | tie %TYPE_MAP, __PACKAGE__; # spent 3µs making 1 call to Moo::HandleMoose::_TypeMap::TIEHASH |
70 | 1 | 4µs | 1 | 6µs | %TYPE_MAP = @types; # spent 6µs making 1 call to Moo::HandleMoose::_TypeMap::CLEAR |
71 | |||||
72 | 1 | 5µs | 1; |