line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
#line 1 |
2
|
1
|
|
|
1
|
|
5215
|
package Test::Requires; |
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
357
|
|
3
|
1
|
|
|
1
|
|
7
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
57
|
|
4
|
|
|
|
|
|
|
use warnings; |
5
|
1
|
|
|
1
|
|
5
|
our $VERSION = '0.01'; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
110
|
|
6
|
1
|
|
|
1
|
|
29
|
use base 'Test::Builder::Module'; |
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
89
|
|
7
|
|
|
|
|
|
|
use 5.008005; |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
our @QUEUE; |
10
|
|
|
|
|
|
|
|
11
|
1
|
|
|
1
|
|
10
|
sub import { |
12
|
1
|
|
|
|
|
3
|
my $class = shift; |
13
|
|
|
|
|
|
|
my $caller = caller(0); |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
# export methods |
16
|
1
|
|
|
1
|
|
6
|
{ |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
857
|
|
|
1
|
|
|
|
|
3
|
|
17
|
1
|
|
|
|
|
3
|
no strict 'refs'; |
|
1
|
|
|
|
|
7
|
|
18
|
|
|
|
|
|
|
*{"$caller\::test_requires"} = \&test_requires; |
19
|
|
|
|
|
|
|
} |
20
|
|
|
|
|
|
|
|
21
|
1
|
50
|
33
|
|
|
10
|
# enqueue the args |
|
|
|
33
|
|
|
|
|
22
|
0
|
|
|
|
|
0
|
if (@_ == 1 && ref $_[0] && ref $_[0] eq 'HASH') { |
|
0
|
|
|
|
|
0
|
|
23
|
0
|
|
|
|
|
0
|
while (my ($mod, $ver) = each %{$_[0]}) { |
24
|
|
|
|
|
|
|
push @QUEUE, [$mod, $ver, $caller]; |
25
|
|
|
|
|
|
|
} |
26
|
1
|
|
|
|
|
2
|
} else { |
27
|
2
|
|
|
|
|
8
|
for my $mod (@_) { |
28
|
|
|
|
|
|
|
push @QUEUE, [$mod, undef, $caller]; |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
|
32
|
1
|
50
|
|
|
|
5
|
# dequeue one argument |
33
|
1
|
|
|
|
|
3
|
if (my $e = shift @QUEUE) { |
34
|
1
|
|
|
|
|
106
|
@_ = @$e; |
35
|
|
|
|
|
|
|
goto \&test_requires; |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
2
|
|
|
2
|
0
|
6
|
sub test_requires { |
40
|
2
|
50
|
|
|
|
7
|
my ( $mod, $ver, $caller ) = @_; |
41
|
2
|
50
|
|
|
|
85
|
return if $mod eq __PACKAGE__; |
42
|
0
|
|
|
|
|
0
|
if (@_ != 3) { |
43
|
|
|
|
|
|
|
$caller = caller(0); |
44
|
|
|
|
|
|
|
} |
45
|
2
|
|
|
|
|
28
|
|
46
|
|
|
|
|
|
|
my $builder = __PACKAGE__->builder; |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
package DB; |
49
|
2
|
|
50
|
2
|
|
17
|
local *DB::_test_requires_foo = sub { |
50
|
1
|
|
|
1
|
|
1507
|
$ver ||= ''; |
|
1
|
|
|
1
|
|
19698
|
|
|
1
|
|
|
|
|
7
|
|
|
1
|
|
|
|
|
1576
|
|
|
1
|
|
|
|
|
69055
|
|
|
1
|
|
|
|
|
27
|
|
|
2
|
|
|
|
|
159
|
|
51
|
2
|
50
|
|
|
|
172
|
eval qq{package $caller; use $mod $ver}; ## no critic. |
52
|
|
|
|
|
|
|
if (my $e = $@) { |
53
|
0
|
0
|
|
|
|
0
|
my $skip_all = sub { |
|
|
0
|
|
|
|
|
|
54
|
0
|
|
|
|
|
0
|
if (not defined $builder->has_plan) { |
55
|
|
|
|
|
|
|
$builder->skip_all(@_); |
56
|
0
|
|
|
|
|
0
|
} elsif ($builder->has_plan eq 'no_plan') { |
57
|
0
|
0
|
|
|
|
0
|
$builder->skip(@_); |
58
|
0
|
|
|
|
|
0
|
if ( $builder->parent ) { |
59
|
|
|
|
|
|
|
die bless {} => 'Test::Builder::Exception'; |
60
|
0
|
|
|
|
|
0
|
} |
61
|
|
|
|
|
|
|
exit 0; |
62
|
0
|
|
|
|
|
0
|
} else { |
63
|
0
|
|
|
|
|
0
|
for (1..$builder->has_plan) { |
64
|
|
|
|
|
|
|
$builder->skip(@_); |
65
|
0
|
0
|
|
|
|
0
|
} |
66
|
0
|
|
|
|
|
0
|
if ( $builder->parent ) { |
67
|
|
|
|
|
|
|
die bless {} => 'Test::Builder::Exception'; |
68
|
0
|
|
|
|
|
0
|
} |
69
|
|
|
|
|
|
|
exit 0; |
70
|
0
|
|
|
|
|
0
|
} |
71
|
0
|
0
|
|
|
|
0
|
}; |
72
|
0
|
|
|
|
|
0
|
if ( $e =~ /^Can't locate/ ) { |
73
|
|
|
|
|
|
|
$skip_all->("Test requires module '$mod' but it's not found"); |
74
|
|
|
|
|
|
|
} |
75
|
0
|
|
|
|
|
0
|
else { |
76
|
|
|
|
|
|
|
$skip_all->("$e"); |
77
|
|
|
|
|
|
|
} |
78
|
|
|
|
|
|
|
} |
79
|
2
|
100
|
|
|
|
58
|
|
80
|
1
|
|
|
|
|
3
|
if (@QUEUE > 0) { |
|
1
|
|
|
|
|
8
|
|
81
|
1
|
|
|
|
|
13
|
@_ = @{ shift @QUEUE }; |
82
|
|
|
|
|
|
|
goto \&Test::Requires::test_requires; |
83
|
2
|
|
|
|
|
12
|
} |
84
|
|
|
|
|
|
|
}; |
85
|
2
|
|
|
|
|
7
|
|
86
|
|
|
|
|
|
|
goto \&DB::_test_requires_foo; |
87
|
|
|
|
|
|
|
} |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
1; |
90
|
|
|
|
|
|
|
__END__ |