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