line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Test2::Tools::Target; |
2
|
156
|
|
|
156
|
|
1632
|
use strict; |
|
156
|
|
|
|
|
302
|
|
|
156
|
|
|
|
|
4462
|
|
3
|
156
|
|
|
156
|
|
761
|
use warnings; |
|
156
|
|
|
|
|
330
|
|
|
156
|
|
|
|
|
6193
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
our $VERSION = '0.000155'; |
6
|
|
|
|
|
|
|
|
7
|
156
|
|
|
156
|
|
921
|
use Carp qw/croak/; |
|
156
|
|
|
|
|
272
|
|
|
156
|
|
|
|
|
7360
|
|
8
|
|
|
|
|
|
|
|
9
|
156
|
|
|
156
|
|
1109
|
use Test2::Util qw/pkg_to_file/; |
|
156
|
|
|
|
|
339
|
|
|
156
|
|
|
|
|
40572
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub import { |
12
|
3
|
|
|
3
|
|
37
|
my $class = shift; |
13
|
|
|
|
|
|
|
|
14
|
3
|
|
|
|
|
9
|
my $caller = caller; |
15
|
3
|
|
|
|
|
14
|
$class->import_into($caller, @_); |
16
|
|
|
|
|
|
|
} |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
sub import_into { |
19
|
69
|
|
|
69
|
0
|
190
|
my $class = shift; |
20
|
69
|
50
|
|
|
|
298
|
my $into = shift or croak "no destination package provided"; |
21
|
|
|
|
|
|
|
|
22
|
69
|
50
|
|
|
|
293
|
croak "No targets specified" unless @_; |
23
|
|
|
|
|
|
|
|
24
|
69
|
|
|
|
|
165
|
my %targets; |
25
|
69
|
100
|
|
|
|
315
|
if (@_ == 1) { |
26
|
68
|
50
|
|
|
|
453
|
if (ref $_[0] eq 'HASH') { |
27
|
0
|
|
|
|
|
0
|
%targets = %{ $_[0] }; |
|
0
|
|
|
|
|
0
|
|
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
else { |
30
|
68
|
|
|
|
|
319
|
($targets{CLASS}) = @_; |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
else { |
34
|
1
|
|
|
|
|
13
|
%targets = @_; |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
69
|
|
|
|
|
432
|
for my $name (keys %targets) { |
38
|
69
|
|
|
|
|
222
|
my $target = $targets{$name}; |
39
|
|
|
|
|
|
|
|
40
|
69
|
|
|
|
|
457
|
my $file = pkg_to_file($target); |
41
|
69
|
|
|
|
|
15184
|
require $file; |
42
|
|
|
|
|
|
|
|
43
|
69
|
|
50
|
|
|
359
|
$name ||= 'CLASS'; |
44
|
|
|
|
|
|
|
|
45
|
69
|
|
|
|
|
173
|
my $const; |
46
|
|
|
|
|
|
|
{ |
47
|
69
|
|
|
|
|
188
|
my $const_target = "$target"; |
|
69
|
|
|
|
|
223
|
|
48
|
69
|
|
|
0
|
|
829
|
$const = sub() { $const_target }; |
|
0
|
|
|
|
|
0
|
|
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
|
51
|
156
|
|
|
156
|
|
1149
|
no strict 'refs'; |
|
156
|
|
|
|
|
618
|
|
|
156
|
|
|
|
|
16896
|
|
52
|
69
|
|
|
|
|
244
|
*{"$into\::$name"} = \$target; |
|
69
|
|
|
|
|
471
|
|
53
|
69
|
|
|
|
|
220
|
*{"$into\::$name"} = $const; |
|
69
|
|
|
|
|
2394
|
|
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
} |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
1; |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
__END__ |