line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
#line 1 |
2
|
1
|
|
|
1
|
|
747
|
package Test::Requires; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
39
|
|
3
|
1
|
|
|
1
|
|
6
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
45
|
|
4
|
|
|
|
|
|
|
use warnings; |
5
|
1
|
|
|
1
|
|
6
|
our $VERSION = '0.01'; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
126
|
|
6
|
1
|
|
|
1
|
|
30
|
use base 'Test::Builder::Module'; |
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
102
|
|
7
|
|
|
|
|
|
|
use 5.008005; |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
our @QUEUE; |
10
|
|
|
|
|
|
|
|
11
|
1
|
|
|
1
|
|
10
|
sub import { |
12
|
1
|
|
|
|
|
2
|
my $class = shift; |
13
|
|
|
|
|
|
|
my $caller = caller(0); |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
# export methods |
16
|
1
|
|
|
1
|
|
5
|
{ |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
630
|
|
|
1
|
|
|
|
|
3
|
|
17
|
1
|
|
|
|
|
3
|
no strict 'refs'; |
|
1
|
|
|
|
|
6
|
|
18
|
|
|
|
|
|
|
*{"$caller\::test_requires"} = \&test_requires; |
19
|
|
|
|
|
|
|
} |
20
|
|
|
|
|
|
|
|
21
|
1
|
50
|
33
|
|
|
14
|
# enqueue the args |
|
|
|
33
|
|
|
|
|
22
|
1
|
|
|
|
|
2
|
if (@_ == 1 && ref $_[0] && ref $_[0] eq 'HASH') { |
|
4
|
|
|
|
|
15
|
|
23
|
3
|
|
|
|
|
12
|
while (my ($mod, $ver) = each %{$_[0]}) { |
24
|
|
|
|
|
|
|
push @QUEUE, [$mod, $ver, $caller]; |
25
|
|
|
|
|
|
|
} |
26
|
0
|
|
|
|
|
0
|
} else { |
27
|
0
|
|
|
|
|
0
|
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
|
|
|
|
|
4
|
@_ = @$e; |
35
|
|
|
|
|
|
|
goto \&test_requires; |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
1
|
|
|
1
|
0
|
2
|
sub test_requires { |
40
|
1
|
50
|
|
|
|
4
|
my ( $mod, $ver, $caller ) = @_; |
41
|
1
|
50
|
|
|
|
4
|
return if $mod eq __PACKAGE__; |
42
|
0
|
|
|
|
|
0
|
if (@_ != 3) { |
43
|
|
|
|
|
|
|
$caller = caller(0); |
44
|
|
|
|
|
|
|
} |
45
|
1
|
|
|
|
|
14
|
|
46
|
|
|
|
|
|
|
my $builder = __PACKAGE__->builder; |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
package DB; |
49
|
1
|
|
50
|
1
|
|
4
|
local *DB::_test_requires_foo = sub { |
50
|
1
|
|
|
1
|
|
539
|
$ver ||= ''; |
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
|
1
|
|
|
|
|
78
|
|
51
|
1
|
50
|
|
|
|
6
|
eval qq{package $caller; use $mod $ver}; ## no critic. |
52
|
|
|
|
|
|
|
if (my $e = $@) { |
53
|
1
|
50
|
|
|
|
5
|
my $skip_all = sub { |
|
|
50
|
|
|
|
|
|
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
|
1
|
|
|
|
|
3
|
} else { |
63
|
5
|
|
|
|
|
21
|
for (1..$builder->has_plan) { |
64
|
|
|
|
|
|
|
$builder->skip(@_); |
65
|
1
|
50
|
|
|
|
7
|
} |
66
|
0
|
|
|
|
|
0
|
if ( $builder->parent ) { |
67
|
|
|
|
|
|
|
die bless {} => 'Test::Builder::Exception'; |
68
|
1
|
|
|
|
|
1426
|
} |
69
|
|
|
|
|
|
|
exit 0; |
70
|
1
|
|
|
|
|
6
|
} |
71
|
1
|
50
|
|
|
|
6
|
}; |
72
|
1
|
|
|
|
|
4
|
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
|
0
|
0
|
|
|
|
0
|
|
80
|
0
|
|
|
|
|
0
|
if (@QUEUE > 0) { |
|
0
|
|
|
|
|
0
|
|
81
|
0
|
|
|
|
|
0
|
@_ = @{ shift @QUEUE }; |
82
|
|
|
|
|
|
|
goto \&Test::Requires::test_requires; |
83
|
1
|
|
|
|
|
6
|
} |
84
|
|
|
|
|
|
|
}; |
85
|
1
|
|
|
|
|
3
|
|
86
|
|
|
|
|
|
|
goto \&DB::_test_requires_foo; |
87
|
|
|
|
|
|
|
} |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
1; |
90
|
|
|
|
|
|
|
__END__ |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
#line 145 |