line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
#line 1 |
2
|
3
|
|
|
3
|
|
1892
|
package Test::Requires; |
|
3
|
|
|
|
|
4
|
|
|
3
|
|
|
|
|
104
|
|
3
|
3
|
|
|
3
|
|
13
|
use strict; |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
118
|
|
4
|
|
|
|
|
|
|
use warnings; |
5
|
3
|
|
|
3
|
|
13
|
our $VERSION = '0.06'; |
|
3
|
|
|
|
|
5
|
|
|
3
|
|
|
|
|
342
|
|
6
|
3
|
|
|
3
|
|
78
|
use base 'Test::Builder::Module'; |
|
3
|
|
|
|
|
9
|
|
|
3
|
|
|
|
|
209
|
|
7
|
|
|
|
|
|
|
use 5.006000; |
8
|
|
|
|
|
|
|
|
9
|
3
|
|
|
3
|
|
18
|
sub import { |
10
|
3
|
|
|
|
|
6
|
my $class = shift; |
11
|
|
|
|
|
|
|
my $caller = caller(0); |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
# export methods |
14
|
3
|
|
|
3
|
|
14
|
{ |
|
3
|
|
|
|
|
4
|
|
|
3
|
|
|
|
|
1487
|
|
|
3
|
|
|
|
|
4
|
|
15
|
3
|
|
|
|
|
6
|
no strict 'refs'; |
|
3
|
|
|
|
|
15
|
|
16
|
|
|
|
|
|
|
*{"$caller\::test_requires"} = \&test_requires; |
17
|
|
|
|
|
|
|
} |
18
|
|
|
|
|
|
|
|
19
|
3
|
50
|
33
|
|
|
38
|
# 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
|
3
|
|
|
|
|
6
|
} else { |
25
|
6
|
|
|
|
|
21
|
for my $mod (@_) { |
26
|
|
|
|
|
|
|
test_requires($mod, undef, $caller); |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
|
31
|
6
|
|
|
6
|
0
|
13
|
sub test_requires { |
32
|
6
|
50
|
|
|
|
21
|
my ( $mod, $ver, $caller ) = @_; |
33
|
6
|
50
|
|
|
|
19
|
return if $mod eq __PACKAGE__; |
34
|
0
|
|
|
|
|
0
|
if (@_ != 3) { |
35
|
|
|
|
|
|
|
$caller = caller(0); |
36
|
6
|
|
50
|
|
|
33
|
} |
37
|
|
|
|
|
|
|
$ver ||= ''; |
38
|
3
|
|
|
3
|
|
6781
|
|
|
3
|
|
|
3
|
|
59631
|
|
|
3
|
|
|
|
|
158
|
|
|
3
|
|
|
|
|
1335
|
|
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
|
6
|
|
|
|
|
432
|
|
39
|
6
|
100
|
|
|
|
51
|
eval qq{package $caller; use $mod $ver}; ## no critic. |
40
|
|
|
|
|
|
|
if (my $e = $@) { |
41
|
3
|
|
|
3
|
|
54
|
my $skip_all = sub { |
42
|
|
|
|
|
|
|
my $builder = __PACKAGE__->builder; |
43
|
3
|
100
|
|
|
|
41
|
|
|
|
50
|
|
|
|
|
|
44
|
1
|
|
|
|
|
16
|
if (not defined $builder->has_plan) { |
45
|
|
|
|
|
|
|
$builder->skip_all(@_); |
46
|
0
|
|
|
|
|
0
|
} elsif ($builder->has_plan eq 'no_plan') { |
47
|
0
|
0
|
0
|
|
|
0
|
$builder->skip(@_); |
48
|
0
|
|
|
|
|
0
|
if ( $builder->can('parent') && $builder->parent ) { |
49
|
|
|
|
|
|
|
die bless {} => 'Test::Builder::Exception'; |
50
|
0
|
|
|
|
|
0
|
} |
51
|
|
|
|
|
|
|
exit 0; |
52
|
2
|
|
|
|
|
34
|
} else { |
53
|
9
|
|
|
|
|
8287
|
for (1..$builder->has_plan) { |
54
|
|
|
|
|
|
|
$builder->skip(@_); |
55
|
2
|
50
|
33
|
|
|
517
|
} |
56
|
0
|
|
|
|
|
0
|
if ( $builder->can('parent') && $builder->parent ) { |
57
|
|
|
|
|
|
|
die bless {} => 'Test::Builder::Exception'; |
58
|
2
|
|
|
|
|
2177
|
} |
59
|
|
|
|
|
|
|
exit 0; |
60
|
3
|
|
|
|
|
23
|
} |
61
|
3
|
50
|
|
|
|
23
|
}; |
62
|
3
|
|
|
|
|
17
|
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__ |