| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Perl::Critic::Policy::References::ProhibitDoubleSigils; |
|
2
|
|
|
|
|
|
|
|
|
3
|
40
|
|
|
40
|
|
26955
|
use 5.010001; |
|
|
40
|
|
|
|
|
200
|
|
|
4
|
40
|
|
|
40
|
|
244
|
use strict; |
|
|
40
|
|
|
|
|
138
|
|
|
|
40
|
|
|
|
|
840
|
|
|
5
|
40
|
|
|
40
|
|
252
|
use warnings; |
|
|
40
|
|
|
|
|
106
|
|
|
|
40
|
|
|
|
|
1016
|
|
|
6
|
40
|
|
|
40
|
|
259
|
use Readonly; |
|
|
40
|
|
|
|
|
108
|
|
|
|
40
|
|
|
|
|
2005
|
|
|
7
|
|
|
|
|
|
|
|
|
8
|
40
|
|
|
40
|
|
279
|
use Perl::Critic::Utils qw{ :severities }; |
|
|
40
|
|
|
|
|
114
|
|
|
|
40
|
|
|
|
|
2072
|
|
|
9
|
40
|
|
|
40
|
|
5335
|
use parent 'Perl::Critic::Policy'; |
|
|
40
|
|
|
|
|
125
|
|
|
|
40
|
|
|
|
|
260
|
|
|
10
|
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
our $VERSION = '1.146'; |
|
12
|
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
#----------------------------------------------------------------------------- |
|
14
|
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
Readonly::Scalar my $DESC => q{Double-sigil dereference}; |
|
16
|
|
|
|
|
|
|
Readonly::Scalar my $EXPL => [ 228 ]; |
|
17
|
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
#----------------------------------------------------------------------------- |
|
19
|
|
|
|
|
|
|
|
|
20
|
93
|
|
|
93
|
0
|
1752
|
sub supported_parameters { return () } |
|
21
|
80
|
|
|
80
|
1
|
376
|
sub default_severity { return $SEVERITY_LOW } |
|
22
|
84
|
|
|
84
|
1
|
407
|
sub default_themes { return qw(core pbp cosmetic) } |
|
23
|
34
|
|
|
34
|
1
|
118
|
sub applies_to { return 'PPI::Token::Cast' } |
|
24
|
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
#----------------------------------------------------------------------------- |
|
26
|
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
sub violates { |
|
28
|
21
|
|
|
21
|
1
|
61
|
my ( $self, $elem, undef ) = @_; |
|
29
|
21
|
100
|
|
|
|
45
|
return if $elem eq q{\\}; |
|
30
|
17
|
100
|
|
|
|
235
|
return if $elem =~ /[@ $ % * &] [*]/xms; |
|
31
|
12
|
100
|
|
|
|
54
|
return if $elem eq q{$#*}; ## no critic (RequireInterpolationOfMetachars) |
|
32
|
|
|
|
|
|
|
|
|
33
|
11
|
|
|
|
|
116
|
my $sib = $elem->snext_sibling; |
|
34
|
11
|
50
|
|
|
|
249
|
return if !$sib; |
|
35
|
11
|
100
|
100
|
|
|
59
|
if ( ! $sib->isa('PPI::Structure::Block') && ! $sib->isa('PPI::Structure::Subscript') ) { |
|
36
|
6
|
|
|
|
|
27
|
return $self->violation( $DESC, $EXPL, $elem ); |
|
37
|
|
|
|
|
|
|
} |
|
38
|
5
|
|
|
|
|
16
|
return; #ok! |
|
39
|
|
|
|
|
|
|
} |
|
40
|
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
1; |
|
42
|
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
__END__ |
|
44
|
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
#----------------------------------------------------------------------------- |
|
46
|
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
=pod |
|
48
|
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
=head1 NAME |
|
50
|
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
Perl::Critic::Policy::References::ProhibitDoubleSigils - Write C<@{ $array_ref }> instead of C<@$array_ref>. |
|
52
|
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
=head1 AFFILIATION |
|
54
|
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
This Policy is part of the core L<Perl::Critic|Perl::Critic> |
|
56
|
|
|
|
|
|
|
distribution. |
|
57
|
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
60
|
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
When dereferencing a reference, put braces around the reference to |
|
62
|
|
|
|
|
|
|
separate the sigils. Especially for newbies, the braces eliminate any |
|
63
|
|
|
|
|
|
|
potential confusion about the relative precedence of the sigils. |
|
64
|
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
push @$array_ref, 'foo', 'bar', 'baz'; #not ok |
|
66
|
|
|
|
|
|
|
push @{ $array_ref }, 'foo', 'bar', 'baz'; #ok |
|
67
|
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
foreach ( keys %$hash_ref ){} #not ok |
|
69
|
|
|
|
|
|
|
foreach ( keys %{ $hash_ref } ){} #ok |
|
70
|
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
=head1 CONFIGURATION |
|
73
|
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
This Policy is not configurable except for the standard options. |
|
75
|
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
=head1 AUTHOR |
|
78
|
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
Jeffrey Ryan Thalhammer <jeff@imaginative-software.com> |
|
80
|
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
=head1 COPYRIGHT |
|
82
|
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
Copyright (c) 2005-2011 Imaginative Software Systems. All rights reserved. |
|
84
|
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify |
|
86
|
|
|
|
|
|
|
it under the same terms as Perl itself. The full text of this license |
|
87
|
|
|
|
|
|
|
can be found in the LICENSE file included with this module. |
|
88
|
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
=cut |
|
90
|
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
# Local Variables: |
|
92
|
|
|
|
|
|
|
# mode: cperl |
|
93
|
|
|
|
|
|
|
# cperl-indent-level: 4 |
|
94
|
|
|
|
|
|
|
# fill-column: 78 |
|
95
|
|
|
|
|
|
|
# indent-tabs-mode: nil |
|
96
|
|
|
|
|
|
|
# c-indentation-style: bsd |
|
97
|
|
|
|
|
|
|
# End: |
|
98
|
|
|
|
|
|
|
# ex: set ts=8 sts=4 sw=4 tw=78 ft=perl expandtab shiftround : |