line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package School::Code::Compare::Charset::NoComments; |
2
|
|
|
|
|
|
|
# ABSTRACT: trim comments since it's mostly irrelevant |
3
|
|
|
|
|
|
|
$School::Code::Compare::Charset::NoComments::VERSION = '0.102'; # TRIAL |
4
|
4
|
|
|
4
|
|
24
|
use strict; |
|
4
|
|
|
|
|
6
|
|
|
4
|
|
|
|
|
101
|
|
5
|
4
|
|
|
4
|
|
19
|
use warnings; |
|
4
|
|
|
|
|
6
|
|
|
4
|
|
|
|
|
1788
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
sub new { |
8
|
20
|
|
|
20
|
0
|
34
|
my $class = shift; |
9
|
|
|
|
|
|
|
|
10
|
20
|
|
|
|
|
32
|
my $self = { |
11
|
|
|
|
|
|
|
}; |
12
|
20
|
|
|
|
|
37
|
bless $self, $class; |
13
|
|
|
|
|
|
|
|
14
|
20
|
|
|
|
|
43
|
return $self; |
15
|
|
|
|
|
|
|
} |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
sub hashy { |
18
|
11
|
|
|
11
|
0
|
17
|
my $self = shift; |
19
|
11
|
|
|
|
|
14
|
my $lines_ref = shift; |
20
|
|
|
|
|
|
|
|
21
|
11
|
|
|
|
|
16
|
my @no_comments; |
22
|
|
|
|
|
|
|
|
23
|
11
|
|
|
|
|
15
|
foreach my $row (@{$lines_ref}) { |
|
11
|
|
|
|
|
23
|
|
24
|
177
|
100
|
|
|
|
362
|
next if ($row =~ /^#/); |
25
|
168
|
100
|
|
|
|
447
|
$row = $1 if ($row =~ /(.*)#.*/); |
26
|
|
|
|
|
|
|
|
27
|
168
|
|
|
|
|
360
|
push @no_comments, $row; |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
|
30
|
11
|
|
|
|
|
34
|
return \@no_comments; |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
sub slashy { |
34
|
6
|
|
|
6
|
0
|
17
|
my $self = shift; |
35
|
6
|
|
|
|
|
9
|
my $lines_ref = shift; |
36
|
|
|
|
|
|
|
|
37
|
6
|
|
|
|
|
8
|
my @no_comments; |
38
|
|
|
|
|
|
|
|
39
|
6
|
|
|
|
|
10
|
foreach my $row (@{$lines_ref}) { |
|
6
|
|
|
|
|
11
|
|
40
|
207
|
100
|
|
|
|
386
|
next if ($row =~ m!^/!); |
41
|
195
|
100
|
|
|
|
291
|
next if ($row =~ m!^\s*\*!); |
42
|
192
|
100
|
|
|
|
290
|
$row = $1 if ($row =~ m!(.*)//.*!); |
43
|
192
|
100
|
|
|
|
273
|
$row = $1 if ($row =~ m!(.*)/\*.*!); |
44
|
192
|
|
|
|
|
1227
|
$row =~ s/\s*//g; |
45
|
192
|
100
|
|
|
|
356
|
next if ($row eq ''); |
46
|
|
|
|
|
|
|
|
47
|
136
|
|
|
|
|
224
|
push @no_comments, $row; |
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
|
50
|
6
|
|
|
|
|
20
|
return \@no_comments; |
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
sub html { |
54
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
55
|
0
|
|
|
|
|
|
my $lines_ref = shift; |
56
|
|
|
|
|
|
|
|
57
|
0
|
|
|
|
|
|
my @no_comments; |
58
|
|
|
|
|
|
|
|
59
|
0
|
|
|
|
|
|
foreach my $row (@{$lines_ref}) { |
|
0
|
|
|
|
|
|
|
60
|
0
|
0
|
|
|
|
|
next if ($row =~ m/^<!--/); |
61
|
0
|
0
|
|
|
|
|
$row = $1 if ($row =~ m/(.*)<!--.*/); |
62
|
0
|
|
|
|
|
|
$row =~ s/\s*//g; |
63
|
0
|
0
|
|
|
|
|
next if ($row eq ''); |
64
|
|
|
|
|
|
|
|
65
|
0
|
|
|
|
|
|
push @no_comments, $row; |
66
|
|
|
|
|
|
|
} |
67
|
|
|
|
|
|
|
|
68
|
0
|
|
|
|
|
|
return \@no_comments; |
69
|
|
|
|
|
|
|
} |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
1; |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
__END__ |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
=pod |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
=encoding UTF-8 |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
=head1 NAME |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
School::Code::Compare::Charset::NoComments - trim comments since it's mostly irrelevant |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
=head1 VERSION |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
version 0.102 |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
=head1 AUTHOR |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
Boris Däppen <bdaeppen.perl@gmail.com> |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
This software is copyright (c) 2020 by Boris Däppen. |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
96
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
=cut |