line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Exporter::Lite; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
require 5.006; |
4
|
1
|
|
|
1
|
|
58527
|
use warnings; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
33
|
|
5
|
1
|
|
|
1
|
|
5
|
use strict; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
59
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our $VERSION = '0.09'; |
8
|
|
|
|
|
|
|
our @EXPORT = qw(import); |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub import { |
12
|
12
|
|
|
12
|
|
10522
|
my($exporter, @imports) = @_; |
13
|
12
|
|
|
|
|
30
|
my($caller, $file, $line) = caller; |
14
|
|
|
|
|
|
|
|
15
|
1
|
|
|
1
|
|
4
|
no strict 'refs'; |
|
1
|
|
|
|
|
9
|
|
|
1
|
|
|
|
|
215
|
|
16
|
|
|
|
|
|
|
|
17
|
12
|
100
|
|
|
|
29
|
unless( @imports ) { # Default import. |
18
|
4
|
|
|
|
|
4
|
@imports = @{$exporter.'::EXPORT'}; |
|
4
|
|
|
|
|
13
|
|
19
|
|
|
|
|
|
|
} |
20
|
|
|
|
|
|
|
else { |
21
|
|
|
|
|
|
|
# Because @EXPORT_OK = () would indicate that nothing is |
22
|
|
|
|
|
|
|
# to be exported, we cannot simply check the length of @EXPORT_OK. |
23
|
|
|
|
|
|
|
# We must do oddness to see if the variable exists at all as |
24
|
|
|
|
|
|
|
# well as avoid autovivification. |
25
|
|
|
|
|
|
|
# XXX idea stolen from base.pm, this might be all unnecessary |
26
|
8
|
|
|
|
|
11
|
my $eokglob; |
27
|
8
|
50
|
50
|
|
|
9
|
if( $eokglob = ${$exporter.'::'}{EXPORT_OK} and *$eokglob{ARRAY} ) { |
|
8
|
|
|
|
|
65
|
|
28
|
8
|
50
|
|
|
|
9
|
if( @{$exporter.'::EXPORT_OK'} ) { |
|
8
|
|
|
|
|
20
|
|
29
|
|
|
|
|
|
|
# This can also be cached. |
30
|
40
|
|
|
|
|
47
|
my %ok = map { s/^&//; $_ => 1 } @{$exporter.'::EXPORT_OK'}, |
|
40
|
|
|
|
|
73
|
|
|
8
|
|
|
|
|
14
|
|
31
|
8
|
|
|
|
|
11
|
@{$exporter.'::EXPORT'}; |
|
8
|
|
|
|
|
17
|
|
32
|
|
|
|
|
|
|
|
33
|
8
|
|
|
|
|
16
|
my($denied) = grep {s/^&//; !$ok{$_}} @imports; |
|
16
|
|
|
|
|
22
|
|
|
16
|
|
|
|
|
31
|
|
34
|
8
|
100
|
|
|
|
28
|
_not_exported($denied, $exporter, $file, $line) if $denied; |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
else { # We don't export anything. |
37
|
0
|
|
|
|
|
0
|
_not_exported($imports[0], $exporter, $file, $line); |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
|
42
|
11
|
|
|
|
|
25
|
_export($caller, $exporter, @imports); |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
sub _export { |
48
|
11
|
|
|
11
|
|
21
|
my($caller, $exporter, @imports) = @_; |
49
|
|
|
|
|
|
|
|
50
|
1
|
|
|
1
|
|
7
|
no strict 'refs'; |
|
1
|
|
|
|
|
7
|
|
|
1
|
|
|
|
|
250
|
|
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
# Stole this from Exporter::Heavy. I'm sure it can be written better |
53
|
|
|
|
|
|
|
# but I'm lazy at the moment. |
54
|
11
|
|
|
|
|
18
|
foreach my $sym (@imports) { |
55
|
|
|
|
|
|
|
# shortcut for the common case of no type character |
56
|
21
|
100
|
|
|
|
64
|
(*{$caller.'::'.$sym} = \&{$exporter.'::'.$sym}, next) |
|
17
|
|
|
|
|
1735
|
|
|
17
|
|
|
|
|
37
|
|
57
|
|
|
|
|
|
|
unless $sym =~ s/^(\W)//; |
58
|
|
|
|
|
|
|
|
59
|
4
|
|
|
|
|
15
|
my $type = $1; |
60
|
4
|
|
|
|
|
9
|
my $caller_sym = $caller.'::'.$sym; |
61
|
4
|
|
|
|
|
8
|
my $export_sym = $exporter.'::'.$sym; |
62
|
4
|
|
|
|
|
290
|
*{$caller_sym} = |
63
|
1
|
|
|
|
|
2
|
$type eq '&' ? \&{$export_sym} : |
64
|
3
|
|
|
|
|
6
|
$type eq '$' ? \${$export_sym} : |
65
|
0
|
|
|
|
|
0
|
$type eq '@' ? \@{$export_sym} : |
66
|
0
|
|
|
|
|
0
|
$type eq '%' ? \%{$export_sym} : |
67
|
0
|
|
|
|
|
0
|
$type eq '*' ? *{$export_sym} : |
68
|
4
|
0
|
|
|
|
13
|
do { require Carp; Carp::croak("Can't export symbol: $type$sym") }; |
|
0
|
0
|
|
|
|
0
|
|
|
0
|
0
|
|
|
|
0
|
|
|
|
50
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
69
|
|
|
|
|
|
|
} |
70
|
|
|
|
|
|
|
} |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
#"# |
74
|
|
|
|
|
|
|
sub _not_exported { |
75
|
1
|
|
|
1
|
|
3
|
my($thing, $exporter, $file, $line) = @_; |
76
|
1
|
|
|
|
|
12
|
die sprintf qq|"%s" is not exported by the %s module at %s line %d\n|, |
77
|
|
|
|
|
|
|
$thing, $exporter, $file, $line; |
78
|
|
|
|
|
|
|
} |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
1; |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
__END__ |