line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package YATT::Lite::Util::Enum; |
2
|
22
|
|
|
22
|
|
112
|
use strict; |
|
22
|
|
|
|
|
35
|
|
|
22
|
|
|
|
|
649
|
|
3
|
22
|
|
|
22
|
|
109
|
use warnings qw(FATAL all NONFATAL misc); |
|
22
|
|
|
|
|
35
|
|
|
22
|
|
|
|
|
922
|
|
4
|
22
|
|
|
22
|
|
679
|
use YATT::Lite::Util qw(globref define_const); |
|
22
|
|
|
|
|
64
|
|
|
22
|
|
|
|
|
5515
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
sub import { |
7
|
53
|
|
|
53
|
|
119
|
my $pack = shift; |
8
|
53
|
|
|
|
|
118
|
my $callpack = caller; |
9
|
|
|
|
|
|
|
my ($export, $export_ok) = map { |
10
|
53
|
|
|
|
|
117
|
my $glob = globref($callpack, $_); |
|
106
|
|
|
|
|
319
|
|
11
|
106
|
100
|
|
|
|
174
|
unless (*{$glob}{ARRAY}) { |
|
106
|
|
|
|
|
332
|
|
12
|
55
|
|
|
|
|
105
|
*$glob = []; |
13
|
|
|
|
|
|
|
} |
14
|
106
|
|
|
|
|
166
|
*{$glob}{ARRAY}; |
|
106
|
|
|
|
|
280
|
|
15
|
|
|
|
|
|
|
} qw(EXPORT EXPORT_OK); |
16
|
53
|
|
66
|
|
|
488
|
while (@_ and my ($prefix, $enumList) = splice @_, 0, 2) { |
17
|
71
|
|
|
|
|
107
|
my $offset = 0; |
18
|
71
|
|
|
|
|
151
|
foreach my $item (@$enumList) { |
19
|
435
|
|
|
|
|
1026
|
foreach my $name (split /=/, $item) { |
20
|
479
|
|
|
|
|
845
|
my $shortName = $prefix . $name; |
21
|
479
|
|
|
|
|
831
|
my $fullName = $callpack . "::" . $shortName; |
22
|
|
|
|
|
|
|
# print STDERR "$fullName\n"; |
23
|
22
|
|
|
22
|
|
123
|
my $glob = do {no strict 'refs'; \*$fullName}; |
|
22
|
|
|
|
|
39
|
|
|
22
|
|
|
|
|
3099
|
|
|
479
|
|
|
|
|
529
|
|
|
479
|
|
|
|
|
2405
|
|
24
|
479
|
|
|
|
|
690
|
my $i = $offset; |
25
|
479
|
|
|
|
|
1439
|
define_const($glob, $i); |
26
|
479
|
100
|
|
|
|
1460
|
unless ($shortName =~ /^_/) { |
27
|
335
|
|
|
|
|
572
|
push @$export_ok, $shortName; |
28
|
335
|
|
|
|
|
825
|
push @$export, $shortName; |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
} continue { |
32
|
435
|
|
|
|
|
92942
|
$offset++; |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
1; |