line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Test2::Tools::Target; |
2
|
155
|
|
|
155
|
|
1489
|
use strict; |
|
155
|
|
|
|
|
300
|
|
|
155
|
|
|
|
|
4257
|
|
3
|
155
|
|
|
155
|
|
748
|
use warnings; |
|
155
|
|
|
|
|
271
|
|
|
155
|
|
|
|
|
5934
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
our $VERSION = '0.000153'; |
6
|
|
|
|
|
|
|
|
7
|
155
|
|
|
155
|
|
817
|
use Carp qw/croak/; |
|
155
|
|
|
|
|
273
|
|
|
155
|
|
|
|
|
6985
|
|
8
|
|
|
|
|
|
|
|
9
|
155
|
|
|
155
|
|
932
|
use Test2::Util qw/pkg_to_file/; |
|
155
|
|
|
|
|
354
|
|
|
155
|
|
|
|
|
37970
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub import { |
12
|
3
|
|
|
3
|
|
40
|
my $class = shift; |
13
|
|
|
|
|
|
|
|
14
|
3
|
|
|
|
|
8
|
my $caller = caller; |
15
|
3
|
|
|
|
|
12
|
$class->import_into($caller, @_); |
16
|
|
|
|
|
|
|
} |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
sub import_into { |
19
|
69
|
|
|
69
|
0
|
213
|
my $class = shift; |
20
|
69
|
50
|
|
|
|
305
|
my $into = shift or croak "no destination package provided"; |
21
|
|
|
|
|
|
|
|
22
|
69
|
50
|
|
|
|
357
|
croak "No targets specified" unless @_; |
23
|
|
|
|
|
|
|
|
24
|
69
|
|
|
|
|
162
|
my %targets; |
25
|
69
|
100
|
|
|
|
306
|
if (@_ == 1) { |
26
|
68
|
50
|
|
|
|
444
|
if (ref $_[0] eq 'HASH') { |
27
|
0
|
|
|
|
|
0
|
%targets = %{ $_[0] }; |
|
0
|
|
|
|
|
0
|
|
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
else { |
30
|
68
|
|
|
|
|
302
|
($targets{CLASS}) = @_; |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
else { |
34
|
1
|
|
|
|
|
8
|
%targets = @_; |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
69
|
|
|
|
|
408
|
for my $name (keys %targets) { |
38
|
69
|
|
|
|
|
206
|
my $target = $targets{$name}; |
39
|
|
|
|
|
|
|
|
40
|
69
|
|
|
|
|
444
|
my $file = pkg_to_file($target); |
41
|
69
|
|
|
|
|
14092
|
require $file; |
42
|
|
|
|
|
|
|
|
43
|
69
|
|
50
|
|
|
339
|
$name ||= 'CLASS'; |
44
|
|
|
|
|
|
|
|
45
|
69
|
|
|
|
|
159
|
my $const; |
46
|
|
|
|
|
|
|
{ |
47
|
69
|
|
|
|
|
169
|
my $const_target = "$target"; |
|
69
|
|
|
|
|
218
|
|
48
|
69
|
|
|
0
|
|
782
|
$const = sub() { $const_target }; |
|
0
|
|
|
|
|
0
|
|
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
|
51
|
155
|
|
|
155
|
|
1113
|
no strict 'refs'; |
|
155
|
|
|
|
|
432
|
|
|
155
|
|
|
|
|
15552
|
|
52
|
69
|
|
|
|
|
234
|
*{"$into\::$name"} = \$target; |
|
69
|
|
|
|
|
455
|
|
53
|
69
|
|
|
|
|
191
|
*{"$into\::$name"} = $const; |
|
69
|
|
|
|
|
2351
|
|
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
} |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
1; |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
__END__ |