| Filename | /usr/share/perl5/Moo/HandleMoose/_TypeMap.pm |
| Statements | Executed 0 statements in 0s |
| Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
|---|---|---|---|---|---|
| 1 | 1 | 1 | 22µs | 81µs | Moo::HandleMoose::_TypeMap::BEGIN@2 |
| 1 | 1 | 1 | 15µs | 26µs | Moo::HandleMoose::_TypeMap::BEGIN@21 |
| 1 | 1 | 1 | 9µs | 19µs | Moo::HandleMoose::_TypeMap::BEGIN@11 |
| 1 | 1 | 1 | 7µs | 7µs | Moo::HandleMoose::_TypeMap::CLEAR |
| 1 | 1 | 1 | 6µs | 6µs | Moo::HandleMoose::_TypeMap::BEGIN@10 |
| 1 | 1 | 1 | 2µs | 2µ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 | 140µs | # spent 81µs (22+59) within Moo::HandleMoose::_TypeMap::BEGIN@2 which was called:
# once (22µs+59µs) by Sub::Defer::BEGIN@5 at line 2 # spent 81µs making 1 call to Moo::HandleMoose::_TypeMap::BEGIN@2
# spent 37µs making 1 call to strictures::import
# spent 22µs making 1 call to strictures::VERSION | ||
| 3 | |||||
| 4 | package | ||||
| 5 | Moo::HandleMoose; | ||||
| 6 | our %TYPE_MAP; | ||||
| 7 | |||||
| 8 | package Moo::HandleMoose::_TypeMap; | ||||
| 9 | |||||
| 10 | 1 | 6µs | # spent 6µs within Moo::HandleMoose::_TypeMap::BEGIN@10 which was called:
# once (6µs+0s) by Sub::Defer::BEGIN@5 at line 10 # spent 6µs making 1 call to Moo::HandleMoose::_TypeMap::BEGIN@10 | ||
| 11 | 2 | 30µs | # spent 19µs (9+10) within Moo::HandleMoose::_TypeMap::BEGIN@11 which was called:
# once (9µs+10µs) by Sub::Defer::BEGIN@5 at line 11 # spent 19µs making 1 call to Moo::HandleMoose::_TypeMap::BEGIN@11
# spent 10µs making 1 call to Config::import | ||
| 12 | |||||
| 13 | 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 | 37µs | # spent 26µs (15+11) within Moo::HandleMoose::_TypeMap::BEGIN@21 which was called:
# once (15µs+11µs) by Sub::Defer::BEGIN@5 at line 21 # spent 26µs making 1 call to Moo::HandleMoose::_TypeMap::BEGIN@21
# spent 11µ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 | # spent 2µs within Moo::HandleMoose::_TypeMap::TIEHASH which was called:
# once (2µ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 | # spent 7µs within Moo::HandleMoose::_TypeMap::CLEAR which was called:
# once (7µ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 | 4µs | if ($Config{useithreads}) { # spent 4µs making 1 call to Config::FETCH | ||
| 70 | my @types = %TYPE_MAP; | ||||
| 71 | 1 | 2µs | tie %TYPE_MAP, __PACKAGE__; # spent 2µs making 1 call to Moo::HandleMoose::_TypeMap::TIEHASH | ||
| 72 | 1 | 7µs | %TYPE_MAP = @types; # spent 7µs making 1 call to Moo::HandleMoose::_TypeMap::CLEAR | ||
| 73 | } | ||||
| 74 | |||||
| 75 | 1; |