/usr/share/perl5/Moo/HandleMoose/_TypeMap.pm is in libmoo-perl 2.000002-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 | package Moo::HandleMoose::_TypeMap;
use Moo::_strictures;
package
Moo::HandleMoose;
our %TYPE_MAP;
package Moo::HandleMoose::_TypeMap;
use Scalar::Util ();
use Config;
our %WEAK_TYPES;
sub _str_to_ref {
my $in = shift;
return $in
if ref $in;
if ($in =~ /(?:^|=)[A-Z]+\(0x([0-9a-zA-Z]+)\)$/) {
my $id = do { no warnings 'portable'; hex "$1" };
require B;
my $sv = bless \$id, 'B::SV';
my $ref = eval { $sv->object_2svref };
if (!defined $ref) {
die <<'END_ERROR';
Moo initialization encountered types defined in a parent thread - ensure that
Moo is require()d before any further thread spawns following a type definition.
END_ERROR
}
return $ref;
}
return $in;
}
sub TIEHASH { bless {}, $_[0] }
sub STORE {
my ($self, $key, $value) = @_;
my $type = _str_to_ref($key);
$WEAK_TYPES{$type} = $type;
Scalar::Util::weaken($WEAK_TYPES{$type})
if ref $type;
$self->{$key} = $value;
}
sub FETCH { $_[0]->{$_[1]} }
sub FIRSTKEY { my $a = scalar keys %{$_[0]}; each %{$_[0]} }
sub NEXTKEY { each %{$_[0]} }
sub EXISTS { exists $_[0]->{$_[1]} }
sub DELETE { delete $_[0]->{$_[1]} }
sub CLEAR { %{$_[0]} = () }
sub SCALAR { scalar %{$_[0]} }
sub CLONE {
my @types = map {
defined $WEAK_TYPES{$_} ? ($WEAK_TYPES{$_} => $TYPE_MAP{$_}) : ()
} keys %TYPE_MAP;
%WEAK_TYPES = ();
%TYPE_MAP = @types;
}
sub DESTROY {
my %types = %{$_[0]};
untie %TYPE_MAP;
%TYPE_MAP = %types;
}
if ($Config{useithreads}) {
my @types = %TYPE_MAP;
tie %TYPE_MAP, __PACKAGE__;
%TYPE_MAP = @types;
}
1;
|