line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
#line 1 |
2
|
6
|
|
|
6
|
|
273583
|
package Test::Requires; |
|
6
|
|
|
|
|
48
|
|
|
6
|
|
|
|
|
184
|
|
3
|
6
|
|
|
6
|
|
780
|
use strict; |
|
6
|
|
|
|
|
3267
|
|
|
6
|
|
|
|
|
261
|
|
4
|
|
|
|
|
|
|
use warnings; |
5
|
5
|
|
|
5
|
|
28
|
our $VERSION = '0.06'; |
|
5
|
|
|
|
|
7
|
|
|
5
|
|
|
|
|
722
|
|
6
|
5
|
|
|
5
|
|
139
|
use base 'Test::Builder::Module'; |
|
5
|
|
|
|
|
17
|
|
7
|
|
|
|
|
|
|
use 5.006000; |
8
|
|
|
|
|
|
|
|
9
|
5
|
|
|
5
|
|
46
|
sub import { |
10
|
5
|
|
|
|
|
14
|
my $class = shift; |
11
|
|
|
|
|
|
|
my $caller = caller(0); |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
# export methods |
14
|
5
|
|
|
5
|
|
33
|
{ |
|
5
|
|
|
|
|
9
|
|
|
5
|
|
|
|
|
2568
|
|
|
5
|
|
|
|
|
9
|
|
15
|
5
|
|
|
|
|
10
|
no strict 'refs'; |
|
5
|
|
|
|
|
32
|
|
16
|
|
|
|
|
|
|
*{"$caller\::test_requires"} = \&test_requires; |
17
|
|
|
|
|
|
|
} |
18
|
|
|
|
|
|
|
|
19
|
5
|
50
|
66
|
|
|
56
|
# 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
|
5
|
|
|
|
|
12
|
} else { |
25
|
7
|
|
|
|
|
20
|
for my $mod (@_) { |
26
|
|
|
|
|
|
|
test_requires($mod, undef, $caller); |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
|
31
|
7
|
|
|
7
|
0
|
20
|
sub test_requires { |
32
|
7
|
50
|
|
|
|
21
|
my ( $mod, $ver, $caller ) = @_; |
33
|
7
|
50
|
|
|
|
20
|
return if $mod eq __PACKAGE__; |
34
|
0
|
|
|
|
|
0
|
if (@_ != 3) { |
35
|
|
|
|
|
|
|
$caller = caller(0); |
36
|
7
|
|
50
|
|
|
37
|
} |
37
|
|
|
|
|
|
|
$ver ||= ''; |
38
|
5
|
|
|
5
|
|
2780
|
|
|
4
|
|
|
|
|
250524
|
|
|
4
|
|
|
|
|
39
|
|
|
7
|
|
|
|
|
447
|
|
39
|
7
|
100
|
|
|
|
4002
|
eval qq{package $caller; use $mod $ver}; ## no critic. |
40
|
|
|
|
|
|
|
if (my $e = $@) { |
41
|
1
|
|
|
1
|
|
9
|
my $skip_all = sub { |
42
|
|
|
|
|
|
|
my $builder = __PACKAGE__->builder; |
43
|
1
|
50
|
|
|
|
13
|
|
|
|
0
|
|
|
|
|
|
44
|
1
|
|
|
|
|
181
|
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
|
1
|
|
|
|
|
5
|
} |
61
|
1
|
50
|
|
|
|
6
|
}; |
62
|
1
|
|
|
|
|
7
|
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__ |