line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
|
2
|
|
|
|
|
|
|
use utf8; |
3
|
8
|
|
|
8
|
|
1641
|
|
|
8
|
|
|
|
|
18
|
|
|
8
|
|
|
|
|
44
|
|
4
|
|
|
|
|
|
|
use 5.010; |
5
|
8
|
|
|
8
|
|
285
|
|
|
8
|
|
|
|
|
25
|
|
6
|
|
|
|
|
|
|
use strict; |
7
|
8
|
|
|
8
|
|
49
|
use warnings; |
|
8
|
|
|
|
|
28
|
|
|
8
|
|
|
|
|
181
|
|
8
|
8
|
|
|
8
|
|
49
|
|
|
8
|
|
|
|
|
18
|
|
|
8
|
|
|
|
|
351
|
|
9
|
|
|
|
|
|
|
our $VERSION = '0.04'; |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
use Readonly; |
12
|
8
|
|
|
8
|
|
982
|
use List::Util qw( first ); |
|
8
|
|
|
|
|
6689
|
|
|
8
|
|
|
|
|
428
|
|
13
|
8
|
|
|
8
|
|
46
|
|
|
8
|
|
|
|
|
18
|
|
|
8
|
|
|
|
|
685
|
|
14
|
|
|
|
|
|
|
use Perl::Critic::Utils qw{ is_hash_key }; |
15
|
8
|
|
|
8
|
|
1319
|
|
|
8
|
|
|
|
|
229108
|
|
|
8
|
|
|
|
|
345
|
|
16
|
|
|
|
|
|
|
use base 'Exporter'; |
17
|
8
|
|
|
8
|
|
1090
|
|
|
8
|
|
|
|
|
16
|
|
|
8
|
|
|
|
|
3116
|
|
18
|
|
|
|
|
|
|
our @EXPORT_OK = qw( search_for_block_keyword ); |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
Readonly::Array my @BLOCK_SEARCH_KEYWORD => qw( |
21
|
|
|
|
|
|
|
SUB |
22
|
|
|
|
|
|
|
IF ELSIF UNLESS |
23
|
|
|
|
|
|
|
WHILE UNTIL |
24
|
|
|
|
|
|
|
DO |
25
|
|
|
|
|
|
|
FOR FOREACH |
26
|
|
|
|
|
|
|
EVAL |
27
|
|
|
|
|
|
|
SORT MAP GREP |
28
|
|
|
|
|
|
|
BEGIN UNITCHECK CHECK INIT END |
29
|
|
|
|
|
|
|
PACKAGE ); |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
Readonly::Scalar my $MAX_KEYWORD_LOOKUP_DEPTH => 10; |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
{ |
34
|
|
|
|
|
|
|
my ( $keyword ) = @_; |
35
|
|
|
|
|
|
|
|
36
|
67
|
|
|
67
|
|
173
|
$keyword = uc $keyword; |
37
|
|
|
|
|
|
|
|
38
|
67
|
|
|
|
|
238
|
my $found = first { $_ eq $keyword } @BLOCK_SEARCH_KEYWORD; |
39
|
|
|
|
|
|
|
|
40
|
67
|
|
|
760
|
|
502
|
return $found; |
|
760
|
|
|
|
|
4075
|
|
41
|
|
|
|
|
|
|
} |
42
|
67
|
|
|
|
|
547
|
|
43
|
|
|
|
|
|
|
{ |
44
|
|
|
|
|
|
|
my ( $elem ) = @_; |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
if ( !ref $elem ) { |
47
|
49
|
|
|
49
|
0
|
125
|
last; |
48
|
|
|
|
|
|
|
} |
49
|
49
|
50
|
|
|
|
195
|
|
50
|
0
|
|
|
|
|
0
|
my $word_search = $elem; |
51
|
|
|
|
|
|
|
my $block_keyword = q{}; |
52
|
|
|
|
|
|
|
|
53
|
49
|
|
|
|
|
97
|
my $i = 1; |
54
|
49
|
|
|
|
|
122
|
|
55
|
|
|
|
|
|
|
while ( !$block_keyword ) { |
56
|
49
|
|
|
|
|
94
|
if ( $i >= $MAX_KEYWORD_LOOKUP_DEPTH ) { |
57
|
|
|
|
|
|
|
last; # recurse abort! |
58
|
49
|
|
|
|
|
143
|
} |
59
|
67
|
50
|
|
|
|
275
|
|
60
|
0
|
|
|
|
|
0
|
my $sprevious = $word_search->sprevious_sibling; |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
if ( !$sprevious || $sprevious == $word_search ) { |
63
|
67
|
|
|
|
|
356
|
last; |
64
|
|
|
|
|
|
|
} |
65
|
67
|
50
|
33
|
|
|
2527
|
|
66
|
0
|
|
|
|
|
0
|
if ( !is_hash_key( $sprevious ) ) { |
67
|
|
|
|
|
|
|
$word_search = $sprevious; |
68
|
|
|
|
|
|
|
|
69
|
67
|
50
|
|
|
|
767
|
my $content_search = $word_search->content; |
70
|
67
|
|
|
|
|
4698
|
|
71
|
|
|
|
|
|
|
$block_keyword = _keyword_in_searchlist( $content_search ); |
72
|
67
|
|
|
|
|
208
|
} |
73
|
|
|
|
|
|
|
|
74
|
67
|
|
|
|
|
983
|
$i++; |
75
|
|
|
|
|
|
|
} |
76
|
|
|
|
|
|
|
|
77
|
67
|
|
|
|
|
219
|
return $block_keyword; |
78
|
|
|
|
|
|
|
} |
79
|
|
|
|
|
|
|
|
80
|
49
|
|
|
|
|
142
|
1; |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
#----------------------------------------------------------------------------- |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
=pod |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
=encoding utf8 |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
=head1 NAME |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
Perl::Critic::Mardem::Util - Internal Util module! |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
=head1 DESCRIPTION |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
Util module with internal subroutines for the |
96
|
|
|
|
|
|
|
L<Perl::Critic::Policy::Mardem>> modules. |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
=head1 AFFILIATION |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
This policy is part of L<Perl::Critic::Mardem>. |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
=head1 AUTHOR |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
Markus Demml, mardem@cpan.com |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
=head1 LICENSE AND COPYRIGHT |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
Copyright (c) 2022, Markus Demml |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
This library is free software; you can redistribute it and/or modify it |
111
|
|
|
|
|
|
|
under the same terms as the Perl 5 programming language system itself. |
112
|
|
|
|
|
|
|
The full text of this license can be found in the LICENSE file included |
113
|
|
|
|
|
|
|
with this module. |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
=cut |