line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
#line 1 |
2
|
115
|
|
|
115
|
|
5051154
|
package Test::Requires; |
|
115
|
|
|
|
|
1060
|
|
|
115
|
|
|
|
|
3762
|
|
3
|
115
|
|
|
115
|
|
11942
|
use strict; |
|
110
|
|
|
|
|
148733
|
|
|
110
|
|
|
|
|
4234
|
|
4
|
|
|
|
|
|
|
use warnings; |
5
|
94
|
|
|
94
|
|
650
|
our $VERSION = '0.06'; |
|
94
|
|
|
|
|
245
|
|
|
94
|
|
|
|
|
18406
|
|
6
|
94
|
|
|
94
|
|
555453
|
use base 'Test::Builder::Module'; |
|
94
|
|
|
|
|
313
|
|
7
|
|
|
|
|
|
|
use 5.006000; |
8
|
|
|
|
|
|
|
|
9
|
115
|
|
|
115
|
|
1952
|
sub import { |
10
|
115
|
|
|
|
|
307
|
my $class = shift; |
11
|
|
|
|
|
|
|
my $caller = caller(0); |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
# export methods |
14
|
94
|
|
|
94
|
|
705
|
{ |
|
94
|
|
|
|
|
238
|
|
|
94
|
|
|
|
|
54851
|
|
|
115
|
|
|
|
|
207
|
|
15
|
115
|
|
|
|
|
249
|
no strict 'refs'; |
|
115
|
|
|
|
|
686
|
|
16
|
|
|
|
|
|
|
*{"$caller\::test_requires"} = \&test_requires; |
17
|
|
|
|
|
|
|
} |
18
|
|
|
|
|
|
|
|
19
|
115
|
100
|
66
|
|
|
1583
|
# test arguments |
|
|
|
66
|
|
|
|
|
20
|
70
|
|
|
|
|
151
|
if (@_ == 1 && ref $_[0] && ref $_[0] eq 'HASH') { |
|
130
|
|
|
|
|
3011
|
|
21
|
70
|
|
|
|
|
231
|
while (my ($mod, $ver) = each %{$_[0]}) { |
22
|
|
|
|
|
|
|
test_requires($mod, $ver, $caller); |
23
|
|
|
|
|
|
|
} |
24
|
45
|
|
|
|
|
120
|
} else { |
25
|
45
|
|
|
|
|
121
|
for my $mod (@_) { |
26
|
|
|
|
|
|
|
test_requires($mod, undef, $caller); |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
|
31
|
115
|
|
|
115
|
0
|
306
|
sub test_requires { |
32
|
115
|
50
|
|
|
|
342
|
my ( $mod, $ver, $caller ) = @_; |
33
|
115
|
50
|
|
|
|
377
|
return if $mod eq __PACKAGE__; |
34
|
0
|
|
|
|
|
0
|
if (@_ != 3) { |
35
|
|
|
|
|
|
|
$caller = caller(0); |
36
|
115
|
|
100
|
|
|
431
|
} |
37
|
|
|
|
|
|
|
$ver ||= ''; |
38
|
94
|
|
|
94
|
|
692
|
|
|
94
|
|
|
94
|
|
188
|
|
|
94
|
|
|
|
|
3416
|
|
|
94
|
|
|
|
|
43899
|
|
|
78
|
|
|
|
|
711434
|
|
|
65
|
|
|
|
|
1068
|
|
|
115
|
|
|
|
|
7138
|
|
39
|
115
|
100
|
|
|
|
254834
|
eval qq{package $caller; no warnings; use $mod $ver}; ## no critic. |
40
|
|
|
|
|
|
|
if (my $e = $@) { |
41
|
22
|
|
|
22
|
|
226
|
my $skip_all = sub { |
42
|
|
|
|
|
|
|
my $builder = __PACKAGE__->builder; |
43
|
22
|
50
|
|
|
|
384
|
|
|
|
0
|
|
|
|
|
|
44
|
22
|
|
|
|
|
3952
|
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
|
22
|
|
|
|
|
158
|
} |
61
|
22
|
100
|
|
|
|
170
|
}; |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
62
|
21
|
|
|
|
|
113
|
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
|
|
|
|
|
5
|
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__ |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
#line 128 |