line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
#line 1 |
2
|
104
|
|
|
104
|
|
5008496
|
package Test::Requires; |
|
104
|
|
|
|
|
960
|
|
|
104
|
|
|
|
|
3140
|
|
3
|
104
|
|
|
104
|
|
4205
|
use strict; |
|
100
|
|
|
|
|
22083
|
|
|
100
|
|
|
|
|
4204
|
|
4
|
|
|
|
|
|
|
use warnings; |
5
|
94
|
|
|
94
|
|
584
|
our $VERSION = '0.06'; |
|
94
|
|
|
|
|
190
|
|
|
94
|
|
|
|
|
18247
|
|
6
|
94
|
|
|
94
|
|
541800
|
use base 'Test::Builder::Module'; |
|
94
|
|
|
|
|
353
|
|
7
|
|
|
|
|
|
|
use 5.006000; |
8
|
|
|
|
|
|
|
|
9
|
104
|
|
|
104
|
|
2043
|
sub import { |
10
|
104
|
|
|
|
|
278
|
my $class = shift; |
11
|
|
|
|
|
|
|
my $caller = caller(0); |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
# export methods |
14
|
94
|
|
|
94
|
|
617
|
{ |
|
94
|
|
|
|
|
200
|
|
|
94
|
|
|
|
|
53793
|
|
|
104
|
|
|
|
|
181
|
|
15
|
104
|
|
|
|
|
207
|
no strict 'refs'; |
|
104
|
|
|
|
|
721
|
|
16
|
|
|
|
|
|
|
*{"$caller\::test_requires"} = \&test_requires; |
17
|
|
|
|
|
|
|
} |
18
|
|
|
|
|
|
|
|
19
|
104
|
100
|
66
|
|
|
1454
|
# test arguments |
|
|
|
66
|
|
|
|
|
20
|
60
|
|
|
|
|
125
|
if (@_ == 1 && ref $_[0] && ref $_[0] eq 'HASH') { |
|
78
|
|
|
|
|
968
|
|
21
|
60
|
|
|
|
|
174
|
while (my ($mod, $ver) = each %{$_[0]}) { |
22
|
|
|
|
|
|
|
test_requires($mod, $ver, $caller); |
23
|
|
|
|
|
|
|
} |
24
|
44
|
|
|
|
|
118
|
} else { |
25
|
44
|
|
|
|
|
117
|
for my $mod (@_) { |
26
|
|
|
|
|
|
|
test_requires($mod, undef, $caller); |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
|
31
|
104
|
|
|
104
|
0
|
248
|
sub test_requires { |
32
|
104
|
50
|
|
|
|
288
|
my ( $mod, $ver, $caller ) = @_; |
33
|
104
|
50
|
|
|
|
349
|
return if $mod eq __PACKAGE__; |
34
|
0
|
|
|
|
|
0
|
if (@_ != 3) { |
35
|
|
|
|
|
|
|
$caller = caller(0); |
36
|
104
|
|
100
|
|
|
380
|
} |
37
|
|
|
|
|
|
|
$ver ||= ''; |
38
|
94
|
|
|
94
|
|
615
|
|
|
94
|
|
|
94
|
|
172
|
|
|
94
|
|
|
|
|
3451
|
|
|
94
|
|
|
|
|
32220
|
|
|
39
|
|
|
|
|
201954
|
|
|
26
|
|
|
|
|
591
|
|
|
104
|
|
|
|
|
6362
|
|
39
|
104
|
100
|
|
|
|
18592
|
eval qq{package $caller; no warnings; use $mod $ver}; ## no critic. |
40
|
|
|
|
|
|
|
if (my $e = $@) { |
41
|
60
|
|
|
60
|
|
497
|
my $skip_all = sub { |
42
|
|
|
|
|
|
|
my $builder = __PACKAGE__->builder; |
43
|
60
|
50
|
|
|
|
889
|
|
|
|
0
|
|
|
|
|
|
44
|
60
|
|
|
|
|
10405
|
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
|
0
|
|
|
|
|
0
|
} else { |
53
|
0
|
|
|
|
|
0
|
for (1..$builder->has_plan) { |
54
|
|
|
|
|
|
|
$builder->skip(@_); |
55
|
0
|
0
|
0
|
|
|
0
|
} |
56
|
0
|
|
|
|
|
0
|
if ( $builder->can('parent') && $builder->parent ) { |
57
|
|
|
|
|
|
|
die bless {} => 'Test::Builder::Exception'; |
58
|
0
|
|
|
|
|
0
|
} |
59
|
|
|
|
|
|
|
exit 0; |
60
|
60
|
|
|
|
|
325
|
} |
61
|
60
|
100
|
|
|
|
408
|
}; |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
62
|
59
|
|
|
|
|
279
|
if ( $e =~ /^Can't locate/ ) { |
63
|
|
|
|
|
|
|
$skip_all->("requires $mod"); |
64
|
|
|
|
|
|
|
} |
65
|
0
|
|
|
|
|
0
|
elsif ( $e =~ /^Perl (\S+) required/ ) { |
66
|
|
|
|
|
|
|
$skip_all->("requires Perl $1"); |
67
|
|
|
|
|
|
|
} |
68
|
1
|
|
|
|
|
7
|
elsif ( $e =~ /^\Q$mod\E version (\S+) required/ ) { |
69
|
|
|
|
|
|
|
$skip_all->("requires $mod $1"); |
70
|
|
|
|
|
|
|
} |
71
|
0
|
|
|
|
|
|
else { |
72
|
|
|
|
|
|
|
$skip_all->("$e"); |
73
|
|
|
|
|
|
|
} |
74
|
|
|
|
|
|
|
} |
75
|
|
|
|
|
|
|
} |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
1; |
78
|
|
|
|
|
|
|
__END__ |