line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Tangerine::hook::mooselike; |
2
|
|
|
|
|
|
|
$Tangerine::hook::mooselike::VERSION = '0.20'; |
3
|
15
|
|
|
15
|
|
1347
|
use 5.010; |
|
15
|
|
|
|
|
49
|
|
4
|
15
|
|
|
15
|
|
75
|
use strict; |
|
15
|
|
|
|
|
25
|
|
|
15
|
|
|
|
|
319
|
|
5
|
15
|
|
|
15
|
|
69
|
use warnings; |
|
15
|
|
|
|
|
23
|
|
|
15
|
|
|
|
|
416
|
|
6
|
15
|
|
|
15
|
|
72
|
use parent 'Tangerine::Hook'; |
|
15
|
|
|
|
|
30
|
|
|
15
|
|
|
|
|
103
|
|
7
|
15
|
|
|
15
|
|
922
|
use List::Util 1.33 qw(any none); |
|
15
|
|
|
|
|
226
|
|
|
15
|
|
|
|
|
1023
|
|
8
|
15
|
|
|
15
|
|
83
|
use Tangerine::Hook; |
|
15
|
|
|
|
|
27
|
|
|
15
|
|
|
|
|
324
|
|
9
|
15
|
|
|
15
|
|
76
|
use Tangerine::HookData; |
|
15
|
|
|
|
|
38
|
|
|
15
|
|
|
|
|
357
|
|
10
|
15
|
|
|
15
|
|
88
|
use Tangerine::Utils qw(stripquotelike); |
|
15
|
|
|
|
|
25
|
|
|
15
|
|
|
|
|
5730
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub run { |
13
|
156
|
|
|
156
|
1
|
239
|
my ($self, $s) = @_; |
14
|
156
|
100
|
100
|
|
|
408
|
if ($self->type eq 'compile' && $s->[0] eq 'use' && |
|
|
100
|
66
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
15
|
376
|
|
|
376
|
|
4588
|
scalar(@$s) > 1 && (any { $s->[1] eq $_ } |
16
|
|
|
|
|
|
|
qw(Moose Mouse Moo Mo Role::Tiny::With))) { |
17
|
6
|
|
|
|
|
76
|
return Tangerine::HookData->new( |
18
|
|
|
|
|
|
|
hooks => [ |
19
|
|
|
|
|
|
|
Tangerine::hook::mooselike->new(type => 'runtime'), |
20
|
|
|
|
|
|
|
], |
21
|
|
|
|
|
|
|
); |
22
|
45
|
|
|
45
|
|
294
|
} elsif ($self->type eq 'runtime' && any { $s->[0] eq $_ } qw(extends with)) { |
23
|
7
|
100
|
100
|
9
|
|
122
|
if (scalar(@$s) > 2 && none { $s->[2] eq $_ } ('=>', ',', ';')) { |
|
9
|
|
|
|
|
62
|
|
24
|
|
|
|
|
|
|
# Bail out; most likely an indirect object method call |
25
|
|
|
|
|
|
|
return |
26
|
1
|
|
|
|
|
20
|
} |
27
|
6
|
|
|
|
|
67
|
my %modules; |
28
|
|
|
|
|
|
|
my $last; |
29
|
6
|
|
|
|
|
17
|
for (my $i = 1; $i < scalar(@$s); $i++) { |
30
|
22
|
100
|
|
41
|
|
171
|
next if any { $s->[$i] eq $_ } ('=>', ','); |
|
41
|
|
|
|
|
515
|
|
31
|
16
|
100
|
|
|
|
409
|
last if $s->[$i] eq ';'; |
32
|
10
|
50
|
|
|
|
311
|
$s->[$i] = substr($s->[$i], 1, -1) if substr($s->[$i], 0, 1) eq '('; |
33
|
10
|
100
|
|
|
|
239
|
if (substr($s->[$i], 0, 1) ne '{') { |
34
|
6
|
|
|
|
|
33
|
my @parents = stripquotelike($s->[$i]); |
35
|
6
|
|
|
|
|
10
|
$last = $parents[-1]; |
36
|
6
|
|
|
|
|
36
|
$modules{$_} = undef for @parents; |
37
|
|
|
|
|
|
|
} else { |
38
|
4
|
50
|
|
|
|
204
|
next unless $last; |
39
|
15
|
|
|
15
|
|
11764
|
$modules{$last} = $+{version} if |
|
15
|
|
|
|
|
7096
|
|
|
15
|
|
|
|
|
3652
|
|
40
|
4
|
50
|
|
|
|
10
|
$s->[$i] =~ /^\{.*-version\s*?(?:=>|,)\s*?(?:(?:qq?\s*?[^\w]\s*)|'|")?v? |
41
|
|
|
|
|
|
|
(?\d+?(?:\.\d+)*)(?:(?:\s*?[^\w])|'|")?.*\}\s*$/xso; |
42
|
4
|
|
|
|
|
257
|
$last = undef; |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
return Tangerine::HookData->new( |
46
|
|
|
|
|
|
|
modules => { |
47
|
|
|
|
|
|
|
map { |
48
|
6
|
|
|
|
|
86
|
( $_ => Tangerine::Occurence->new(version => $modules{$_}) ) |
|
7
|
|
|
|
|
23
|
|
49
|
|
|
|
|
|
|
} keys %modules, |
50
|
|
|
|
|
|
|
}, |
51
|
|
|
|
|
|
|
); |
52
|
|
|
|
|
|
|
} |
53
|
143
|
|
|
|
|
803
|
return; |
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
1; |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
__END__ |