line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Test::SkipWithout; |
2
|
4
|
|
|
4
|
|
64239
|
use strict; |
|
4
|
|
|
|
|
7
|
|
|
4
|
|
|
|
|
145
|
|
3
|
4
|
|
|
4
|
|
17
|
use warnings; |
|
4
|
|
|
|
|
5
|
|
|
4
|
|
|
|
|
1113
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
our $VERSION = "0.001_001"; |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
sub import { |
8
|
4
|
|
|
4
|
|
27
|
my $class = shift; |
9
|
4
|
|
|
|
|
10
|
my ($module, $version) = @_; |
10
|
|
|
|
|
|
|
|
11
|
4
|
|
|
|
|
10
|
my ($pkg, $file, $line) = caller; |
12
|
|
|
|
|
|
|
|
13
|
4
|
|
|
|
|
228
|
my $ok = eval qq{require $module; 1}; |
14
|
4
|
|
|
|
|
10
|
my $err = $@; |
15
|
|
|
|
|
|
|
|
16
|
4
|
100
|
|
|
|
15
|
unless ($ok) { |
17
|
|
|
|
|
|
|
# This will probably break in perl5i since it changes the message, oh well. |
18
|
1
|
50
|
|
|
|
14
|
return skip("$module is not installed, skipping test.") |
19
|
|
|
|
|
|
|
if $err =~ m/Can't locate .* in \@INC/; |
20
|
|
|
|
|
|
|
|
21
|
0
|
|
|
|
|
0
|
die "Error loading module '$module' at $file line $line.\n$err"; |
22
|
|
|
|
|
|
|
} |
23
|
|
|
|
|
|
|
|
24
|
3
|
50
|
|
|
|
9
|
return unless $version; |
25
|
|
|
|
|
|
|
|
26
|
3
|
|
|
|
|
5
|
$ok = eval {$module->VERSION($version)}; |
|
3
|
|
|
|
|
78
|
|
27
|
3
|
|
|
|
|
11
|
$err = $@; |
28
|
|
|
|
|
|
|
|
29
|
3
|
100
|
|
|
|
1375
|
unless ($ok) { |
30
|
2
|
50
|
|
|
|
155
|
if ($err =~ m/^($module version \S+ required--this is only version \S+) at/) { |
31
|
2
|
|
|
|
|
6
|
return skip($1); |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
|
34
|
0
|
|
|
|
|
0
|
die "Error checking version for module '$module' at $file line $line.\n$err"; |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
sub skip { |
39
|
3
|
|
|
3
|
0
|
6
|
my ($reason) = @_; |
40
|
|
|
|
|
|
|
|
41
|
3
|
|
|
|
|
13
|
require Test::More; |
42
|
3
|
|
|
|
|
11
|
Test::More::plan('skip_all' => $reason); |
43
|
|
|
|
|
|
|
|
44
|
0
|
|
|
|
|
|
exit 0; |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
1; |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
__END__ |