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