line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Tangerine::hook::moduleruntime; |
2
|
|
|
|
|
|
|
$Tangerine::hook::moduleruntime::VERSION = '0.20'; |
3
|
15
|
|
|
15
|
|
1382
|
use 5.010; |
|
15
|
|
|
|
|
47
|
|
4
|
15
|
|
|
15
|
|
77
|
use strict; |
|
15
|
|
|
|
|
28
|
|
|
15
|
|
|
|
|
319
|
|
5
|
15
|
|
|
15
|
|
76
|
use warnings; |
|
15
|
|
|
|
|
34
|
|
|
15
|
|
|
|
|
402
|
|
6
|
15
|
|
|
15
|
|
84
|
use parent 'Tangerine::Hook'; |
|
15
|
|
|
|
|
24
|
|
|
15
|
|
|
|
|
98
|
|
7
|
15
|
|
|
15
|
|
960
|
use List::Util 1.33 qw(any none); |
|
15
|
|
|
|
|
219
|
|
|
15
|
|
|
|
|
1130
|
|
8
|
15
|
|
|
15
|
|
79
|
use Tangerine::HookData; |
|
15
|
|
|
|
|
26
|
|
|
15
|
|
|
|
|
359
|
|
9
|
15
|
|
|
15
|
|
69
|
use Tangerine::Occurence; |
|
15
|
|
|
|
|
28
|
|
|
15
|
|
|
|
|
355
|
|
10
|
15
|
|
|
15
|
|
77
|
use Tangerine::Utils qw(stripquotelike); |
|
15
|
|
|
|
|
28
|
|
|
15
|
|
|
|
|
5855
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub run { |
13
|
136
|
|
|
136
|
1
|
215
|
my ($self, $s) = @_; |
14
|
136
|
|
|
|
|
292
|
my @routines = qw(require_module use_module use_package_optimistically); |
15
|
136
|
100
|
66
|
194
|
|
525
|
if ((any { $s->[0] eq $_ } qw(use no)) && scalar(@$s) > 1 && |
|
194
|
|
100
|
|
|
1145
|
|
16
|
|
|
|
|
|
|
$s->[1] eq 'Module::Runtime') { |
17
|
2
|
|
|
|
|
73
|
return Tangerine::HookData->new( hooks => [ |
18
|
|
|
|
|
|
|
Tangerine::hook::moduleruntime->new(type => 'runtime') ] ); |
19
|
|
|
|
|
|
|
} |
20
|
|
|
|
|
|
|
# NOTE: For the sake of simplicity, we only check for one subroutine |
21
|
|
|
|
|
|
|
# call per statement. |
22
|
134
|
100
|
66
|
6
|
|
3023
|
if ($self->type eq 'runtime' && any { my $f = $_; any { $_ eq $f } @$s } |
|
6
|
|
|
|
|
42
|
|
|
6
|
|
|
|
|
22
|
|
|
25
|
|
|
|
|
346
|
|
23
|
|
|
|
|
|
|
@routines) { |
24
|
3
|
|
|
15
|
|
54
|
while (none { $s->[0] eq $_ } @routines) { |
|
15
|
|
|
|
|
125
|
|
25
|
3
|
|
|
|
|
46
|
shift @$s; |
26
|
|
|
|
|
|
|
} |
27
|
3
|
|
33
|
|
|
56
|
for (my $clip = 0; $clip <= $#$s && $clip < 3; $clip++) { |
28
|
9
|
100
|
|
17
|
|
194
|
if (any { $s->[$clip] eq $_ } qw(-> ;)) { |
|
17
|
|
|
|
|
194
|
|
29
|
3
|
|
|
|
|
46
|
@$s = @$s[0..$clip-1]; |
30
|
|
|
|
|
|
|
last |
31
|
3
|
|
|
|
|
6
|
} |
32
|
|
|
|
|
|
|
} |
33
|
3
|
|
|
|
|
15
|
my @args = stripquotelike(@$s[1..$#$s]); |
34
|
3
|
|
|
|
|
13
|
return Tangerine::HookData->new( |
35
|
|
|
|
|
|
|
modules => { |
36
|
|
|
|
|
|
|
$args[0] => Tangerine::Occurence->new( |
37
|
|
|
|
|
|
|
version => $args[1] |
38
|
|
|
|
|
|
|
), |
39
|
|
|
|
|
|
|
}, |
40
|
|
|
|
|
|
|
); |
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
1; |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
__END__ |