line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Tangerine::hook::testrequires; |
2
|
|
|
|
|
|
|
$Tangerine::hook::testrequires::VERSION = '0.20'; |
3
|
15
|
|
|
15
|
|
1341
|
use 5.010; |
|
15
|
|
|
|
|
53
|
|
4
|
15
|
|
|
15
|
|
76
|
use strict; |
|
15
|
|
|
|
|
32
|
|
|
15
|
|
|
|
|
310
|
|
5
|
15
|
|
|
15
|
|
75
|
use warnings; |
|
15
|
|
|
|
|
26
|
|
|
15
|
|
|
|
|
436
|
|
6
|
15
|
|
|
15
|
|
74
|
use parent 'Tangerine::Hook'; |
|
15
|
|
|
|
|
25
|
|
|
15
|
|
|
|
|
189
|
|
7
|
15
|
|
|
15
|
|
925
|
use List::Util 1.33 qw(any); |
|
15
|
|
|
|
|
228
|
|
|
15
|
|
|
|
|
928
|
|
8
|
15
|
|
|
15
|
|
85
|
use Tangerine::HookData; |
|
15
|
|
|
|
|
27
|
|
|
15
|
|
|
|
|
346
|
|
9
|
15
|
|
|
15
|
|
83
|
use Tangerine::Occurence; |
|
15
|
|
|
|
|
24
|
|
|
15
|
|
|
|
|
438
|
|
10
|
15
|
|
|
15
|
|
74
|
use Tangerine::Utils qw(stripquotelike $vre); |
|
15
|
|
|
|
|
36
|
|
|
15
|
|
|
|
|
7887
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub run { |
13
|
137
|
|
|
137
|
1
|
223
|
my ($self, $s) = @_; |
14
|
137
|
|
|
|
|
166
|
my %found; |
15
|
137
|
100
|
100
|
|
|
380
|
if ($self->type eq 'compile' && |
|
|
100
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
66
|
|
|
|
|
16
|
187
|
|
|
187
|
|
1142
|
(any { $s->[0] eq $_ } qw(use no)) && scalar(@$s) > 2 && |
17
|
|
|
|
|
|
|
$s->[1] eq 'Test::Requires') { |
18
|
3
|
|
|
|
|
115
|
my ($version) = $s->[2] =~ $vre; |
19
|
3
|
|
50
|
|
|
138
|
$version //= ''; |
20
|
3
|
50
|
33
|
|
|
20
|
return if !$version && stripquotelike($s->[2]) =~ /^v?5(?:\..*)?$/; |
21
|
3
|
50
|
|
|
|
7
|
my $voffset = $version ? 3 : 2; |
22
|
3
|
|
|
|
|
5
|
my @args; |
23
|
3
|
50
|
|
|
|
7
|
if (scalar(@$s) > $voffset) { |
24
|
3
|
50
|
|
|
|
9
|
return if $s->[$voffset] eq ';'; |
25
|
3
|
|
|
|
|
156
|
@args = @$s; |
26
|
3
|
|
|
|
|
11
|
@args = @args[($voffset) .. $#args]; |
27
|
3
|
|
|
|
|
8
|
@args = stripquotelike(@args); |
28
|
|
|
|
|
|
|
} |
29
|
3
|
100
|
|
|
|
12
|
if (substr($s->[$voffset], 0, 1) eq '{') { |
30
|
1
|
|
|
|
|
73
|
%found = @args; |
31
|
|
|
|
|
|
|
} else { |
32
|
2
|
|
|
|
|
50
|
%found = map { $_ => '' } @args; |
|
6
|
|
|
|
|
19
|
|
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
} elsif ($self->type eq 'runtime' && |
35
|
|
|
|
|
|
|
$s->[0] eq 'test_requires' && scalar(@$s) > 1) { |
36
|
2
|
50
|
|
|
|
36
|
return if $s->[1] eq ';'; |
37
|
2
|
|
|
|
|
65
|
my @args = stripquotelike((@$s)[1..$#$s]); |
38
|
2
|
100
|
66
|
|
|
13
|
$found{$args[0]} = $args[1] && $args[1] ne ';' ? $args[1] : ''; |
39
|
|
|
|
|
|
|
} else { |
40
|
|
|
|
|
|
|
return |
41
|
132
|
|
|
|
|
764
|
} |
42
|
|
|
|
|
|
|
return Tangerine::HookData->new( |
43
|
|
|
|
|
|
|
modules => { |
44
|
|
|
|
|
|
|
map { |
45
|
5
|
|
|
|
|
18
|
( $_ => Tangerine::Occurence->new(version => $found{$_}) ) |
|
10
|
|
|
|
|
31
|
|
46
|
|
|
|
|
|
|
} keys %found, |
47
|
|
|
|
|
|
|
}, |
48
|
|
|
|
|
|
|
) |
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
1; |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
__END__ |