line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# ABSTRACT: Import Routines By Any Means Necessary |
2
|
|
|
|
|
|
|
package Extorter; |
3
|
|
|
|
|
|
|
|
4
|
2
|
|
|
2
|
|
15802
|
use 5.10.0; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
77
|
|
5
|
|
|
|
|
|
|
|
6
|
2
|
|
|
2
|
|
8
|
use strict; |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
53
|
|
7
|
2
|
|
|
2
|
|
22
|
use warnings; |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
49
|
|
8
|
|
|
|
|
|
|
|
9
|
2
|
|
|
2
|
|
875
|
use Import::Into; |
|
2
|
|
|
|
|
4307
|
|
|
2
|
|
|
|
|
539
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
our $VERSION = '0.08'; # VERSION |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub import { |
14
|
4
|
|
|
4
|
|
29
|
my $class = shift; |
15
|
4
|
|
|
|
|
7
|
my $target = caller; |
16
|
|
|
|
|
|
|
|
17
|
4
|
100
|
|
|
|
28
|
my @imports = @_ or return; |
18
|
3
|
|
|
|
|
12
|
$class->extort::into($target, $_) for @imports; |
19
|
|
|
|
|
|
|
|
20
|
3
|
|
|
|
|
1899
|
return; |
21
|
|
|
|
|
|
|
} |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
sub extort::into { |
24
|
14
|
|
|
14
|
|
1667
|
my $class = shift; |
25
|
14
|
|
|
|
|
13
|
my $target = shift; |
26
|
|
|
|
|
|
|
|
27
|
14
|
50
|
|
|
|
43
|
my @imports = @_ or return; |
28
|
|
|
|
|
|
|
|
29
|
14
|
50
|
|
|
|
45
|
@imports = map join('::', $imports[0], $_), @imports[1..$#imports] |
30
|
|
|
|
|
|
|
if @imports > 1; |
31
|
|
|
|
|
|
|
|
32
|
14
|
|
|
|
|
14
|
my %seen; |
33
|
14
|
|
|
|
|
19
|
for my $import (@imports) { |
34
|
14
|
|
|
|
|
78
|
my @captures = $import =~ /(.*)(?:\^|::)(.*)/; |
35
|
14
|
100
|
|
|
|
34
|
@captures = $import =~ /^\*(.*)/ unless @captures; |
36
|
|
|
|
|
|
|
|
37
|
14
|
|
|
|
|
23
|
my ($namespace, $argument) = @captures; |
38
|
14
|
50
|
|
|
|
26
|
next unless $namespace; |
39
|
|
|
|
|
|
|
|
40
|
14
|
100
|
|
|
|
25
|
unless ($argument) { |
41
|
3
|
|
|
|
|
12
|
$namespace->import::into($target); |
42
|
3
|
|
|
|
|
1053
|
next; |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
|
45
|
11
|
50
|
|
|
|
589
|
$seen{$namespace}++ |
46
|
|
|
|
|
|
|
|| eval "require $namespace"; |
47
|
|
|
|
|
|
|
|
48
|
11
|
50
|
|
|
|
8530
|
if ($argument =~ /\W/) { |
49
|
0
|
|
|
|
|
0
|
$namespace->import::into($target, $argument); |
50
|
0
|
|
|
|
|
0
|
next; |
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
|
53
|
2
|
|
|
2
|
|
14
|
no strict 'refs'; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
167
|
|
54
|
11
|
|
|
|
|
13
|
my %EXPORT_TAGS = %{"${namespace}::EXPORT_TAGS"}; |
|
11
|
|
|
|
|
67
|
|
55
|
11
|
50
|
|
|
|
28
|
if ($EXPORT_TAGS{$argument}) { |
56
|
0
|
|
|
|
|
0
|
$namespace->import::into($target, $argument); |
57
|
0
|
|
|
|
|
0
|
next; |
58
|
|
|
|
|
|
|
} |
59
|
|
|
|
|
|
|
|
60
|
11
|
50
|
|
|
|
87
|
if ($namespace->can($argument)) { |
61
|
2
|
|
|
2
|
|
14
|
no warnings 'redefine'; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
324
|
|
62
|
11
|
|
|
|
|
12
|
*{"${target}::${argument}"} = \&{"${namespace}::${argument}"}; |
|
11
|
|
|
|
|
47
|
|
|
11
|
|
|
|
|
28
|
|
63
|
11
|
|
|
|
|
42
|
next; |
64
|
|
|
|
|
|
|
} |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
# fallback |
67
|
0
|
|
|
|
|
0
|
$namespace->import::into($target, $argument); |
68
|
|
|
|
|
|
|
} |
69
|
|
|
|
|
|
|
|
70
|
14
|
|
|
|
|
54
|
return; |
71
|
|
|
|
|
|
|
} |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
1; |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
__END__ |