line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Constant::Exporter; |
2
|
3
|
|
|
3
|
|
84130
|
use strict; |
|
3
|
|
|
|
|
8
|
|
|
3
|
|
|
|
|
98
|
|
3
|
3
|
|
|
3
|
|
15
|
use warnings; |
|
3
|
|
|
|
|
5
|
|
|
3
|
|
|
|
|
941
|
|
4
|
|
|
|
|
|
|
our $VERSION = '0.01'; |
5
|
|
|
|
|
|
|
require Exporter; |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
sub import { |
8
|
3
|
|
|
3
|
|
74
|
my ($class, %args) = @_; |
9
|
3
|
|
|
|
|
6
|
my (@export, @export_ok, %export_tags, %constants); |
10
|
|
|
|
|
|
|
|
11
|
3
|
|
|
|
|
8
|
for my $key (qw/ EXPORT_TAGS EXPORT_OK_TAGS /) { |
12
|
6
|
50
|
|
|
|
8
|
for my $tag (keys %{ $args{$key} || {} }) { |
|
6
|
|
|
|
|
42
|
|
13
|
9
|
|
50
|
|
|
51
|
$export_tags{$tag} ||= []; |
14
|
9
|
50
|
|
|
|
14
|
for my $name (keys %{ $args{$key}->{$tag} || {} }) { |
|
9
|
|
|
|
|
42
|
|
15
|
24
|
|
|
|
|
59
|
$constants{$name} = $args{$key}->{$tag}{$name}; |
16
|
24
|
|
|
|
|
26
|
push @{$export_tags{$tag}}, $name; |
|
24
|
|
|
|
|
48
|
|
17
|
|
|
|
|
|
|
|
18
|
24
|
100
|
|
|
|
71
|
if ($key eq 'EXPORT_TAGS') { |
|
|
50
|
|
|
|
|
|
19
|
6
|
|
|
|
|
21
|
push @export, $name; |
20
|
|
|
|
|
|
|
} elsif ($key eq 'EXPORT_OK_TAGS') { |
21
|
18
|
|
|
|
|
46
|
push @export_ok, $name; |
22
|
|
|
|
|
|
|
} |
23
|
|
|
|
|
|
|
} |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
|
27
|
3
|
|
|
|
|
6
|
for my $key (qw/ EXPORT EXPORT_OK /) { |
28
|
6
|
50
|
|
|
|
22
|
for my $name (keys %{ $args{$key} || {} }) { |
|
6
|
|
|
|
|
29
|
|
29
|
6
|
|
|
|
|
13
|
$constants{$name} = $args{$key}->{$name}; |
30
|
6
|
100
|
|
|
|
23
|
if ($key eq 'EXPORT') { |
|
|
50
|
|
|
|
|
|
31
|
3
|
|
|
|
|
10
|
push @export, $name; |
32
|
|
|
|
|
|
|
} elsif ($key eq 'EXPORT_OK') { |
33
|
3
|
|
|
|
|
12
|
push @export_ok, $name; |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
|
38
|
3
|
|
|
|
|
9
|
my $pkg = caller; |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
{ |
41
|
3
|
|
|
3
|
|
18
|
no strict 'refs'; |
|
3
|
|
|
|
|
17
|
|
|
3
|
|
|
|
|
790
|
|
|
3
|
|
|
|
|
4
|
|
42
|
3
|
|
|
|
|
51
|
for my $name (keys %constants) { |
43
|
30
|
|
|
|
|
54
|
my $value = $constants{$name}; |
44
|
30
|
|
|
0
|
|
167
|
*{"${pkg}::${name}"} = sub () { $value }; |
|
30
|
|
|
|
|
171
|
|
|
0
|
|
|
|
|
0
|
|
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
|
47
|
3
|
|
|
|
|
28
|
push @{"${pkg}::ISA"}, 'Exporter'; |
|
3
|
|
|
|
|
42
|
|
48
|
3
|
|
|
|
|
5
|
push @{"${pkg}::EXPORT"}, @export; |
|
3
|
|
|
|
|
17
|
|
49
|
3
|
|
|
|
|
7
|
push @{"${pkg}::EXPORT_OK"}, @export_ok; |
|
3
|
|
|
|
|
19
|
|
50
|
3
|
|
|
|
|
9
|
%{"${pkg}::EXPORT_TAGS"} = %export_tags; |
|
3
|
|
|
|
|
18
|
|
51
|
|
|
|
|
|
|
|
52
|
3
|
|
|
|
|
121
|
*{"${pkg}::import"} = sub { |
53
|
3
|
|
|
3
|
|
37
|
my $pkg = shift; |
54
|
3
|
|
|
|
|
5917
|
$pkg->export_to_level(1, undef, @_) |
55
|
3
|
|
|
|
|
9
|
}; |
56
|
|
|
|
|
|
|
} |
57
|
|
|
|
|
|
|
} |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
1; |
60
|
|
|
|
|
|
|
__END__ |