line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package ExportAbove; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
416
|
use strict; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
29
|
|
4
|
1
|
|
|
1
|
|
4
|
use vars qw($VERSION); |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
80
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
$VERSION = '0.02'; |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
my %Already; |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
sub import { |
11
|
9
|
|
|
9
|
|
490
|
my($class, @args) = @_; |
12
|
9
|
|
|
|
|
11
|
my $from = caller; |
13
|
1
|
|
|
1
|
|
5
|
no strict 'refs'; |
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
365
|
|
14
|
9
|
|
|
|
|
11
|
for my $sym(keys %{$from."::"}) { |
|
9
|
|
|
|
|
177
|
|
15
|
221
|
100
|
|
|
|
763
|
next if $sym =~ /^[A-Z]+$/; # neglect BEGIN, AUTOLOAD, ... |
16
|
196
|
|
|
|
|
182
|
my @expnames; |
17
|
1
|
100
|
|
1
|
|
800
|
if( defined *{$from."::".$sym}{CODE} ) { |
|
1
|
|
|
|
|
1219
|
|
|
1
|
|
|
|
|
7
|
|
|
196
|
|
|
|
|
174
|
|
|
196
|
|
|
|
|
688
|
|
18
|
10
|
|
|
|
|
18
|
push @expnames, newname($from, $sym); |
19
|
|
|
|
|
|
|
} |
20
|
196
|
50
|
|
|
|
179
|
if( defined *{$from."::".$sym}{SCALAR} ) { |
|
196
|
|
|
|
|
541
|
|
21
|
196
|
|
|
|
|
396
|
push @expnames, newname($from, '$'.$sym); |
22
|
|
|
|
|
|
|
} |
23
|
196
|
100
|
|
|
|
226
|
if( defined *{$from."::".$sym}{HASH} ) { |
|
196
|
|
|
|
|
520
|
|
24
|
59
|
|
|
|
|
121
|
push @expnames, newname($from, '%'.$sym); |
25
|
|
|
|
|
|
|
} |
26
|
196
|
100
|
|
|
|
201
|
if( defined *{$from."::".$sym}{ARRAY} ) { |
|
196
|
|
|
|
|
501
|
|
27
|
9
|
|
|
|
|
18
|
push @expnames, newname($from, '@'.$sym); |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
#print "@expnames\n"; |
30
|
196
|
100
|
|
|
|
288
|
if( @args ) { |
31
|
15
|
|
|
|
|
18
|
my($taged, $oked) = (0, 0); |
32
|
15
|
|
|
|
|
45
|
for my $arg(@args) { |
33
|
22
|
100
|
|
|
|
35
|
if( $arg eq 'OK' ) { |
34
|
10
|
|
|
|
|
9
|
push @{$from."::EXPORT_OK"}, @expnames; |
|
10
|
|
|
|
|
24
|
|
35
|
10
|
|
|
|
|
16
|
$oked = 1; |
36
|
|
|
|
|
|
|
} else { |
37
|
12
|
|
|
|
|
19
|
$arg =~ s/^://; |
38
|
12
|
|
|
|
|
12
|
push @{${$from."::EXPORT_TAGS"}{$arg}}, @expnames; |
|
12
|
|
|
|
|
12
|
|
|
12
|
|
|
|
|
34
|
|
39
|
12
|
|
|
|
|
23
|
$taged = 1; |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
} |
42
|
15
|
100
|
100
|
|
|
151
|
if( $taged && !$oked) { |
43
|
5
|
|
|
|
|
5
|
push @{$from."::EXPORT"}, @expnames; |
|
5
|
|
|
|
|
16
|
|
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
} else { |
46
|
181
|
|
|
|
|
191
|
push @{$from."::EXPORT"}, @expnames; |
|
181
|
|
|
|
|
672
|
|
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
sub unimport { |
52
|
1
|
|
|
1
|
|
58
|
my $from = caller; |
53
|
1
|
|
|
1
|
|
5
|
no strict 'refs'; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
211
|
|
54
|
1
|
|
|
|
|
2
|
for my $sym(keys %{$from."::"}) { |
|
1
|
|
|
|
|
4
|
|
55
|
10
|
100
|
|
|
|
72
|
next if $sym =~ /^[A-Z]+$/; |
56
|
8
|
100
|
|
|
|
8
|
if( defined *{$from."::".$sym}{CODE} ) { |
|
8
|
|
|
|
|
32
|
|
57
|
5
|
|
|
|
|
9
|
newname($from, $sym); |
58
|
|
|
|
|
|
|
} |
59
|
8
|
50
|
|
|
|
8
|
if( defined *{$from."::".$sym}{SCALAR} ) { |
|
8
|
|
|
|
|
25
|
|
60
|
8
|
|
|
|
|
19
|
newname($from, '$'.$sym); |
61
|
|
|
|
|
|
|
} |
62
|
8
|
100
|
|
|
|
9
|
if( defined *{$from."::".$sym}{HASH} ) { |
|
8
|
|
|
|
|
26
|
|
63
|
2
|
|
|
|
|
5
|
newname($from, '%'.$sym); |
64
|
|
|
|
|
|
|
} |
65
|
8
|
100
|
|
|
|
8
|
if( defined *{$from."::".$sym}{ARRAY} ) { |
|
8
|
|
|
|
|
25
|
|
66
|
2
|
|
|
|
|
6
|
newname($from, '@'.$sym); |
67
|
|
|
|
|
|
|
} |
68
|
|
|
|
|
|
|
} |
69
|
|
|
|
|
|
|
} |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
sub newname { |
72
|
291
|
|
|
291
|
0
|
358
|
my($pkg, $name) = @_; |
73
|
291
|
100
|
|
|
|
540
|
if( $Already{$pkg}{$name} ) { |
74
|
44
|
|
|
|
|
67
|
return (); |
75
|
|
|
|
|
|
|
} else { |
76
|
247
|
|
|
|
|
452
|
$Already{$pkg}{$name}++; |
77
|
247
|
|
|
|
|
476
|
return ($name); |
78
|
|
|
|
|
|
|
} |
79
|
|
|
|
|
|
|
} |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
1; |
82
|
|
|
|
|
|
|
__END__ |