line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Code::TidyAll::Plugin::Perl::IgnoreMethodSignaturesSimple; |
2
|
|
|
|
|
|
|
$Code::TidyAll::Plugin::Perl::IgnoreMethodSignaturesSimple::VERSION = '0.03'; |
3
|
1
|
|
|
1
|
|
950
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
36
|
|
4
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
34
|
|
5
|
1
|
|
|
1
|
|
14
|
use base qw(Code::TidyAll::Plugin); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
972
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
sub preprocess_source { |
8
|
0
|
|
|
0
|
1
|
|
my ( $self, $source ) = @_; |
9
|
|
|
|
|
|
|
|
10
|
0
|
|
|
|
|
|
$source =~ |
11
|
0
|
|
|
|
|
|
s/^\h*(method|func)\s+(\w+)([^\{]+)\{/$self->_munged_sub($1, $2, $3)/gme; |
12
|
|
|
|
|
|
|
|
13
|
0
|
|
|
|
|
|
return $source; |
14
|
|
|
|
|
|
|
} |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
sub postprocess_source { |
17
|
0
|
|
|
0
|
1
|
|
my ( $self, $source ) = @_; |
18
|
|
|
|
|
|
|
|
19
|
0
|
|
|
|
|
|
foreach my $id ( keys( %{ $self->{saves} } ) ) { |
|
0
|
|
|
|
|
|
|
20
|
0
|
|
|
|
|
|
my ( $keyword, $name, $rest ) = @{ $self->{saves}->{$id} }; |
|
0
|
|
|
|
|
|
|
21
|
0
|
|
|
|
|
|
for ( $name, $rest ) { s/^\s+//; s/\s+$// } |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
# Blank parens if no params list |
24
|
|
|
|
|
|
|
# |
25
|
0
|
0
|
|
|
|
|
$rest = '()' if $rest !~ /\S/; |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
# No space inside parens |
28
|
|
|
|
|
|
|
# |
29
|
0
|
|
|
|
|
|
$rest =~ s/\(\s+/\(/; |
30
|
0
|
|
|
|
|
|
$rest =~ s/\s+\)/\)/; |
31
|
|
|
|
|
|
|
|
32
|
0
|
|
|
|
|
|
$source =~ s/sub MUNGED_${id}_/$keyword $name $rest/; |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
0
|
|
|
|
|
|
return $source; |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
sub _munged_sub { |
39
|
0
|
|
|
0
|
|
|
my ( $self, $keyword, $name, $rest ) = @_; |
40
|
|
|
|
|
|
|
|
41
|
0
|
|
|
|
|
|
my $id = $self->_unique_id; |
42
|
0
|
|
|
|
|
|
$self->{saves}->{$id} = [ $keyword, $name, $rest ]; |
43
|
0
|
|
|
|
|
|
return "sub MUNGED_${id}_ {"; |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
my $unique_id = 0; |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
sub _unique_id { |
49
|
0
|
|
|
0
|
|
|
return join( '_', time, $unique_id++ ); |
50
|
|
|
|
|
|
|
} |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
1; |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
__END__ |