line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
#line 1 |
2
|
1
|
|
|
1
|
|
3126
|
package Test::Requires; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
53
|
|
3
|
1
|
|
|
1
|
|
5
|
use strict; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
1037
|
|
4
|
|
|
|
|
|
|
use warnings; |
5
|
1
|
|
|
1
|
|
8
|
our $VERSION = '0.03'; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
424
|
|
6
|
1
|
|
|
1
|
|
35
|
use base 'Test::Builder::Module'; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
318
|
|
7
|
|
|
|
|
|
|
use 5.008000; |
8
|
|
|
|
|
|
|
|
9
|
1
|
|
|
1
|
|
9
|
sub import { |
10
|
1
|
|
|
|
|
2
|
my $class = shift; |
11
|
|
|
|
|
|
|
my $caller = caller(0); |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
# export methods |
14
|
1
|
|
|
1
|
|
59
|
{ |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
695
|
|
|
1
|
|
|
|
|
2
|
|
15
|
1
|
|
|
|
|
3
|
no strict 'refs'; |
|
1
|
|
|
|
|
7
|
|
16
|
|
|
|
|
|
|
*{"$caller\::test_requires"} = \&test_requires; |
17
|
|
|
|
|
|
|
} |
18
|
|
|
|
|
|
|
|
19
|
1
|
50
|
33
|
|
|
10
|
# test arguments |
|
|
|
33
|
|
|
|
|
20
|
0
|
|
|
|
|
0
|
if (@_ == 1 && ref $_[0] && ref $_[0] eq 'HASH') { |
|
0
|
|
|
|
|
0
|
|
21
|
0
|
|
|
|
|
0
|
while (my ($mod, $ver) = each %{$_[0]}) { |
22
|
|
|
|
|
|
|
test_requires($mod, $ver, $caller); |
23
|
|
|
|
|
|
|
} |
24
|
1
|
|
|
|
|
3
|
} else { |
25
|
2
|
|
|
|
|
7
|
for my $mod (@_) { |
26
|
|
|
|
|
|
|
test_requires($mod, undef, $caller); |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
|
31
|
2
|
|
|
2
|
0
|
6
|
sub test_requires { |
32
|
2
|
50
|
|
|
|
8
|
my ( $mod, $ver, $caller ) = @_; |
33
|
2
|
50
|
|
|
|
9
|
return if $mod eq __PACKAGE__; |
34
|
0
|
|
|
|
|
0
|
if (@_ != 3) { |
35
|
|
|
|
|
|
|
$caller = caller(0); |
36
|
2
|
|
50
|
|
|
13
|
} |
37
|
|
|
|
|
|
|
$ver ||= ''; |
38
|
1
|
|
|
1
|
|
1736
|
|
|
1
|
|
|
1
|
|
39590
|
|
|
1
|
|
|
|
|
27
|
|
|
1
|
|
|
|
|
1296
|
|
|
1
|
|
|
|
|
80641
|
|
|
1
|
|
|
|
|
116
|
|
|
2
|
|
|
|
|
1271
|
|
39
|
2
|
50
|
|
|
|
62
|
eval qq{package $caller; use $mod $ver}; ## no critic. |
40
|
|
|
|
|
|
|
if (my $e = $@) { |
41
|
0
|
|
|
0
|
|
|
my $skip_all = sub { |
42
|
|
|
|
|
|
|
my $builder = __PACKAGE__->builder; |
43
|
0
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
44
|
0
|
|
|
|
|
|
if (not defined $builder->has_plan) { |
45
|
|
|
|
|
|
|
$builder->skip_all(@_); |
46
|
0
|
|
|
|
|
|
} elsif ($builder->has_plan eq 'no_plan') { |
47
|
0
|
0
|
0
|
|
|
|
$builder->skip(@_); |
48
|
0
|
|
|
|
|
|
if ( $builder->can('parent') && $builder->parent ) { |
49
|
|
|
|
|
|
|
die bless {} => 'Test::Builder::Exception'; |
50
|
0
|
|
|
|
|
|
} |
51
|
|
|
|
|
|
|
exit 0; |
52
|
0
|
|
|
|
|
|
} else { |
53
|
0
|
|
|
|
|
|
for (1..$builder->has_plan) { |
54
|
|
|
|
|
|
|
$builder->skip(@_); |
55
|
0
|
0
|
0
|
|
|
|
} |
56
|
0
|
|
|
|
|
|
if ( $builder->can('parent') && $builder->parent ) { |
57
|
|
|
|
|
|
|
die bless {} => 'Test::Builder::Exception'; |
58
|
0
|
|
|
|
|
|
} |
59
|
|
|
|
|
|
|
exit 0; |
60
|
0
|
|
|
|
|
|
} |
61
|
0
|
0
|
|
|
|
|
}; |
62
|
0
|
|
|
|
|
|
if ( $e =~ /^Can't locate/ ) { |
63
|
|
|
|
|
|
|
$skip_all->("Test requires module '$mod' but it's not found"); |
64
|
|
|
|
|
|
|
} |
65
|
0
|
|
|
|
|
|
else { |
66
|
|
|
|
|
|
|
$skip_all->("$e"); |
67
|
|
|
|
|
|
|
} |
68
|
|
|
|
|
|
|
} |
69
|
|
|
|
|
|
|
} |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
1; |
72
|
|
|
|
|
|
|
__END__ |