line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package YATT::Lite::Util::Enum; |
2
|
30
|
|
|
30
|
|
195
|
use strict; |
|
30
|
|
|
|
|
71
|
|
|
30
|
|
|
|
|
963
|
|
3
|
30
|
|
|
30
|
|
183
|
use warnings qw(FATAL all NONFATAL misc); |
|
30
|
|
|
|
|
66
|
|
|
30
|
|
|
|
|
1234
|
|
4
|
30
|
|
|
30
|
|
515
|
use YATT::Lite::Util qw(globref define_const); |
|
30
|
|
|
|
|
56
|
|
|
30
|
|
|
|
|
6006
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
sub import { |
7
|
79
|
|
|
79
|
|
223
|
my $pack = shift; |
8
|
79
|
|
|
|
|
221
|
my $callpack = caller; |
9
|
|
|
|
|
|
|
my ($export, $export_ok) = map { |
10
|
79
|
|
|
|
|
207
|
my $glob = globref($callpack, $_); |
|
158
|
|
|
|
|
493
|
|
11
|
158
|
100
|
|
|
|
331
|
unless (*{$glob}{ARRAY}) { |
|
158
|
|
|
|
|
535
|
|
12
|
85
|
|
|
|
|
213
|
*$glob = []; |
13
|
|
|
|
|
|
|
} |
14
|
158
|
|
|
|
|
280
|
*{$glob}{ARRAY}; |
|
158
|
|
|
|
|
460
|
|
15
|
|
|
|
|
|
|
} qw(EXPORT EXPORT_OK); |
16
|
79
|
|
66
|
|
|
631
|
while (@_ and my ($prefix, $enumList) = splice @_, 0, 2) { |
17
|
109
|
|
|
|
|
221
|
my $offset = 0; |
18
|
109
|
|
|
|
|
261
|
foreach my $item (@$enumList) { |
19
|
699
|
|
|
|
|
1663
|
foreach my $name (split /=/, $item) { |
20
|
767
|
|
|
|
|
1535
|
my $shortName = $prefix . $name; |
21
|
767
|
|
|
|
|
1376
|
my $fullName = $callpack . "::" . $shortName; |
22
|
|
|
|
|
|
|
# print STDERR "$fullName\n"; |
23
|
30
|
|
|
30
|
|
214
|
my $glob = do {no strict 'refs'; \*$fullName}; |
|
30
|
|
|
|
|
72
|
|
|
30
|
|
|
|
|
3459
|
|
|
767
|
|
|
|
|
1083
|
|
|
767
|
|
|
|
|
3085
|
|
24
|
767
|
|
|
|
|
1273
|
my $i = $offset; |
25
|
767
|
|
|
|
|
2058
|
define_const($glob, $i); |
26
|
767
|
100
|
|
|
|
2252
|
unless ($shortName =~ /^_/) { |
27
|
533
|
|
|
|
|
1061
|
push @$export_ok, $shortName; |
28
|
533
|
|
|
|
|
1286
|
push @$export, $shortName; |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
} continue { |
32
|
699
|
|
|
|
|
109325
|
$offset++; |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
1; |