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