{
name => 'global_variable_exemptions',
description => 'Global variable names that are exempt from capitalization rules. The values here are regexes.',
- default_string => '\$VERSION @ISA @EXPORT(?:_OK)? %EXPORT_TAGS \$AUTOLOAD %ENV %SIG',
+ default_string => '\$VERSION @ISA @EXPORT(?:_OK)? %EXPORT_TAGS \$AUTOLOAD %ENV %SIG', ## no critic (RequireInterpolation)
behavior => 'string list',
},
{
# Fully qualified names are exempt because we can't be responsible
# for other people's sybols.
next NAME if $name =~ m/$PACKAGE_REGEX/xms;
- next NAME if any { $_ eq $name } @B::Keywords::Symbols;
+ next NAME if any { $_ eq $name } @B::Keywords::Symbols; ## no critic (ProhibitPackageVars)
push
@violations,
# Get the children we care about
my @schild = grep { $_->significant } $self->children;
- shift @schild if $schild[0]->isa('PPI::Token::Label');
+ if ($schild[0]->isa('PPI::Token::Label')) { shift @schild; }
# If the second child is a symbol, return its name
if ( $schild[1]->isa('PPI::Token::Symbol') ) {
}
# erm... this is unexpected
- ();
+ return ();
}
sub _local_variable {
# The last symbol should be a variable
my $n = $el->snext_sibling or return 1;
my $p = $el->sprevious_sibling;
- if ( ! $p or $p eq ',' ) {
+ if ( !$p || $p eq $COMMA ) {
# In the middle of a list
- return 1 if $n eq ',';
+ return 1 if $n eq $COMMA;
# The first half of an assignment
- return 1 if $n eq '=';
+ return 1 if $n eq $EQUAL;
}
# Lets say no for know... additional work
# should go here.
- return '';
+ return $EMPTY;
}
1;
#-----------------------------------------------------------------------------
+=pod
+
+=for stopwords Schwern
+
=head1 NAME
Perl::Critic::Policy::NamingConventions::Capitalization - Distinguish different program components by case.
$COMMA
$DQUOTE
$EMPTY
+ $EQUAL
$FATCOMMA
$PERIOD
$PIPE
$COMMA
$DQUOTE
$EMPTY
+ $EQUAL
$FATCOMMA
$PERIOD
$PIPE
#-----------------------------------------------------------------------------
Readonly::Scalar our $COMMA => q{,};
+Readonly::Scalar our $EQUAL => q{=};
Readonly::Scalar our $FATCOMMA => q{=>};
Readonly::Scalar our $COLON => q{:};
Readonly::Scalar our $SCOLON => q{;};