line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Mic::Implementation; |
2
|
|
|
|
|
|
|
|
3
|
33
|
|
|
33
|
|
10625
|
use strict; |
|
33
|
|
|
|
|
73
|
|
|
33
|
|
|
|
|
983
|
|
4
|
33
|
|
|
33
|
|
174
|
use Mic::_Guts; |
|
33
|
|
|
|
|
63
|
|
|
33
|
|
|
|
|
738
|
|
5
|
33
|
|
|
33
|
|
176
|
use Package::Stash; |
|
33
|
|
|
|
|
62
|
|
|
33
|
|
|
|
|
837
|
|
6
|
33
|
|
|
33
|
|
166
|
use Params::Validate qw(:all); |
|
33
|
|
|
|
|
62
|
|
|
33
|
|
|
|
|
6004
|
|
7
|
33
|
|
|
33
|
|
6076
|
use Readonly; |
|
33
|
|
|
|
|
63293
|
|
|
33
|
|
|
|
|
12914
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
sub import { |
10
|
49
|
|
|
49
|
|
2162
|
my $class = shift; |
11
|
|
|
|
|
|
|
|
12
|
49
|
|
|
|
|
1227
|
my %arg = validate(@_, { |
13
|
|
|
|
|
|
|
has => { type => HASHREF }, |
14
|
|
|
|
|
|
|
classmethod => { type => ARRAYREF, optional => 1 }, |
15
|
|
|
|
|
|
|
}); |
16
|
|
|
|
|
|
|
|
17
|
49
|
|
|
|
|
479
|
strict->import(); |
18
|
|
|
|
|
|
|
|
19
|
49
|
|
|
|
|
206
|
$arg{-caller} = (caller)[0]; |
20
|
49
|
|
|
|
|
726
|
$class->define(%arg); |
21
|
|
|
|
|
|
|
} |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
sub define { |
24
|
49
|
|
|
49
|
0
|
171
|
my ($class, %arg) = @_; |
25
|
|
|
|
|
|
|
|
26
|
49
|
|
33
|
|
|
224
|
my $caller_pkg = delete $arg{-caller} || (caller)[0]; |
27
|
49
|
|
|
|
|
671
|
my $stash = Package::Stash->new($caller_pkg); |
28
|
|
|
|
|
|
|
|
29
|
49
|
|
|
|
|
279
|
$class->update_args(\%arg); |
30
|
49
|
|
|
|
|
195
|
$class->add_attribute_syms(\%arg, $stash); |
31
|
|
|
|
|
|
|
|
32
|
49
|
|
|
|
|
328
|
$stash->add_symbol('%__meta__', \%arg); |
33
|
49
|
|
|
|
|
196
|
$class->install_subs($stash); |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
sub add_attribute_syms { |
37
|
33
|
|
|
33
|
0
|
89
|
my ($class, $arg, $stash) = @_; |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
my @slots = ( |
40
|
33
|
|
|
|
|
55
|
keys %{ $arg->{has} }, |
|
33
|
|
|
|
|
125
|
|
41
|
|
|
|
|
|
|
'', # semiprivate pkg |
42
|
|
|
|
|
|
|
); |
43
|
33
|
|
|
|
|
83
|
foreach my $slot ( @slots ) { |
44
|
79
|
|
|
|
|
213
|
$class->add_obfu_name($arg, $stash, $slot); |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
} |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
sub add_obfu_name { |
49
|
79
|
|
|
79
|
0
|
166
|
my ($class, $arg, $stash, $slot) = @_; |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
Readonly my $sym_val => sprintf( |
52
|
|
|
|
|
|
|
"%s-$slot", |
53
|
79
|
|
|
|
|
352
|
Mic::_Guts::attribute_sym($arg->{version}), |
54
|
|
|
|
|
|
|
); |
55
|
79
|
|
|
|
|
7643
|
$Mic::_Guts::obfu_name{$slot} = $sym_val; |
56
|
|
|
|
|
|
|
|
57
|
79
|
|
|
|
|
531
|
my $prefix = ''; |
58
|
79
|
100
|
|
|
|
196
|
if($slot eq '') { |
59
|
33
|
|
|
|
|
70
|
$prefix = '__'; |
60
|
|
|
|
|
|
|
} |
61
|
|
|
|
|
|
|
else { |
62
|
46
|
|
|
|
|
110
|
$slot = uc $slot; |
63
|
|
|
|
|
|
|
} |
64
|
79
|
|
|
|
|
1050
|
$stash->add_symbol( |
65
|
|
|
|
|
|
|
sprintf('$%s%s', $prefix, $slot), |
66
|
|
|
|
|
|
|
\ $sym_val |
67
|
|
|
|
|
|
|
); |
68
|
|
|
|
|
|
|
} |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
33
|
0
|
|
sub update_args {} |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
49
|
0
|
|
sub install_subs {} |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
1; |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
__END__ |