=head1 NAME Perl::Critic::PolicySummary - Descriptions of the Policy modules included with L itself. =head1 DESCRIPTION The following Policy modules are distributed with Perl::Critic. (There are additional Policies that can be found in add-on distributions.) The Policy modules have been categorized according to the table of contents in Damian Conway's book B. Since most coding standards take the form "do this..." or "don't do that...", I have adopted the convention of naming each module C or C. Each Policy is listed here with its default severity. If you don't agree with the default severity, you can change it in your F<.perlcriticrc> file (try C for a starting version). See the documentation of each module for its specific details. =head1 POLICIES =head2 L Use C from C, C, or C instead of C in boolean context. [Default severity 2] =head2 L Map blocks should have a single statement. [Default severity 3] =head2 L Use 4-argument C instead of writing C. [Default severity 3] =head2 L Forbid $b before $a in sort blocks. [Default severity 1] =head2 L Prohibit C<\shift> in code [Default severity 3] =head2 L Use L instead of something like C. [Default severity 5] =head2 L Write C instead of C. [Default severity 5] =head2 L Write C instead of C. [Default severity 2] =head2 L Write C<< eval { $foo->can($name) } >> instead of C. [Default severity 3] =head2 L Write C<< eval { $foo->isa($pkg) } >> instead of C. [Default severity 3] =head2 L Don't pass $_ to built-in functions that assume it, or to most filetest operators. [Default severity 2] =head2 L Don't use C in void contexts. [Default severity 3] =head2 L Don't use C in void contexts. [Default severity 3] =head2 L Write C instead of C. [Default severity 4] =head2 L Write C instead of C. [Default severity 4] =head2 L Use C instead of <*>. [Default severity 5] =head2 L Sort blocks should have a single statement. [Default severity 3] =head2 L AUTOLOAD methods should be avoided. [Default severity 3] =head2 L Employ C instead of C<@ISA>. [Default severity 3] =head2 L Write C instead of just C. [Default severity 5] =head2 L Use spaces instead of tabs. [Default severity 3] =head2 L Write C instead of C. [Default severity 1] =head2 L Write C instead of C<('foo', 'bar', 'baz')>. [Default severity 2] =head2 L Don't use whitespace at the end of lines. [Default severity 1] =head2 L Use the same newline through the source. [Default severity 4] =head2 L Must run code through L. [Default severity 1] =head2 L Put a comma at the end of every multi-line list declaration, including the last one. [Default severity 1] =head2 L Write C instead of C. [Default severity 2] =head2 L Don't write long "if-elsif-elsif-elsif-elsif...else" chains. [Default severity 3] =head2 L Don't write deeply nested loops and conditionals. [Default severity 3] =head2 L Don't use labels that are the same as the special block names. [Default severity 4] =head2 L Don't modify C<$_> in list functions. [Default severity 5] =head2 L Don't use operators like C, C, and C within C and C. [Default severity 3] =head2 L Write C instead of C. [Default severity 2] =head2 L Write C instead of C. [Default severity 2] =head2 L Don't write code after an unconditional C. [Default severity 4] =head2 L Write C instead of C. [Default severity 2] =head2 L Never use C<...> in production code. [Default severity 4] =head2 L Check your spelling. [Default severity 1] =head2 L The C<=head1 NAME> section should match the package. [Default severity 1] =head2 L All POD should be after C<__END__>. [Default severity 1] =head2 L Organize your POD into the customary sections. [Default severity 2] =head2 L Use functions from L instead of C or C. [Default severity 3] =head2 L You can't depend upon the value of C<$@>/C<$EVAL_ERROR> to tell whether an C failed. [Default severity 3] =head2 L Discourage stuff like C<@files = `ls $directory`>. [Default severity 3] =head2 L Write C instead of C. [Default severity 5] =head2 L Write C instead of C. [Default severity 5] =head2 L Use "<>" or "" or a prompting module instead of "". [Default severity 4] =head2 L Use prompt() instead of -t. [Default severity 5] =head2 L Use C or L instead of joined readline. [Default severity 3] =head2 L Never write C. [Default severity 4] =head2 L Write C<< while( $line = <> ){...} >> instead of C<< for(<>){...} >>. [Default severity 4] =head2 L Write C<< open $fh, q{<}, $filename; >> instead of C<< open $fh, "<$filename"; >>. [Default severity 5] =head2 L Write C instead of C. [Default severity 1] =head2 L Close filehandles as soon as possible after opening them. [Default severity 4] =head2 L Write C<< my $error = close $fh; >> instead of C<< close $fh; >>. [Default severity 2] =head2 L Write C<< my $error = open $fh, $mode, $filename; >> instead of C<< open $fh, $mode, $filename; >>. [Default severity 3] =head2 L Return value of flagged function ignored. [Default severity 1] =head2 L Write C<< open $fh, q{<:encoding(UTF-8)}, $filename; >> instead of C<< open $fh, q{<:utf8}, $filename; >>. [Default severity 5] =head2 L Do not use C. [Default severity 3] =head2 L Do not use C. [Default severity 2] =head2 L Forbid a bare C<## no critic> [Default severity 3] =head2 L Remove ineffective "## no critic" annotations. [Default severity 2] =head2 L Export symbols via C<@EXPORT_OK> or C<%EXPORT_TAGS> instead of C<@EXPORT>. [Default severity 4] =head2 L Avoid putting conditional logic around compile-time includes. [Default severity 3] =head2 L Ban modules that aren't blessed by your shop. [Default severity 5] =head2 L Minimize complexity in code that is B of subroutines. [Default severity 3] =head2 L Put packages (especially subclasses) in separate files. [Default severity 4] =head2 L Write C instead of C. [Default severity 5] =head2 L End each module with an explicitly C<1;> instead of some funky expression. [Default severity 4] =head2 L Always make the C explicit. [Default severity 4] =head2 L Package declaration must match filename. [Default severity 5] =head2 L C must be passed a C<-no_match_vars> argument. [Default severity 2] =head2 L Give every module a C<$VERSION> number. [Default severity 2] =head2 L Distinguish different program components by case. [Default severity 1] =head2 L Don't use vague variable or subroutine names like 'last' or 'record'. [Default severity 3] =head2 L Prohibit indirect object call syntax. [Default severity 4] =head2 L Write C<@{ $array_ref }> instead of C<@$array_ref>. [Default severity 2] =head2 L Capture variable used outside conditional. [Default severity 3] =head2 L Split long regexps into smaller C chunks. [Default severity 3] =head2 L Use named character classes instead of explicit character lists. [Default severity 1] =head2 L Use character classes for literal meta-characters instead of escapes. [Default severity 1] =head2 L Use C or hash instead of fixed-pattern regexps. [Default severity 2] =head2 L Use C<[abc]> instead of C. [Default severity 1] =head2 L Only use a capturing group if you plan to use the captured value. [Default severity 3] =head2 L Use only C or C<{}> to delimit regexps. [Default severity 1] =head2 L Don't use $_ to match against regexes. [Default severity 2] =head2 L Use C<{> and C<}> to delimit multi-line regexps. [Default severity 1] =head2 L Always use the C modifier with regular expressions. [Default severity 2] =head2 L Always use the C modifier with regular expressions. [Default severity 3] =head2 L Always use the C modifier with regular expressions. [Default severity 2] =head2 L Don't call functions with a leading ampersand sigil. [Default severity 2] =head2 L Don't declare your own C function. [Default severity 4] =head2 L Minimize complexity by factoring code into smaller subroutines. [Default severity 3] =head2 L Return failure with bare C instead of C. [Default severity 5] =head2 L Too many arguments. [Default severity 3] =head2 L C. [Default severity 5] =head2 L Behavior of C is not defined if called in scalar context. [Default severity 5] =head2 L Don't write C. [Default severity 5] =head2 L Prevent unused private subroutines. [Default severity 3] =head2 L Prevent access to private subs in other packages. [Default severity 3] =head2 L Always unpack C<@_> first. [Default severity 4] =head2 L End every path through a subroutine with an explicit C statement. [Default severity 4] =head2 L Prohibit various flavors of C. [Default severity 5] =head2 L Prohibit various flavors of C. [Default severity 4] =head2 L Don't turn off strict for large blocks of code. [Default severity 4] =head2 L Tests should all have labels. [Default severity 3] =head2 L Always C. [Default severity 5] =head2 L Always C. [Default severity 4] =head2 L Don't use the comma operator as a statement separator. [Default severity 4] =head2 L Prohibit version values from outside the module. [Default severity 3] =head2 L Don't C<< use constant FOO => 15 >>. [Default severity 4] =head2 L Write C instead of C<''>. [Default severity 2] =head2 L Write C<"\N{DELETE}"> instead of C<"\x7F">, etc. [Default severity 2] =head2 L Use concatenation or HEREDOCs instead of literal line breaks in strings. [Default severity 3] =head2 L Always use single quotes for literal strings. [Default severity 1] =head2 L Write C instead of C<0755>. [Default severity 5] =head2 L Long chains of method calls indicate tightly coupled code. [Default severity 2] =head2 L Don't use values that don't explain themselves. [Default severity 2] =head2 L Don't mix numeric operators with string operands, or vice-versa. [Default severity 3] =head2 L Write C< !$foo && $bar || $baz > instead of C< not $foo && $bar or $baz>. [Default severity 4] =head2 L Use C or C instead of quotes for awkward-looking strings. [Default severity 2] =head2 L Don't use quotes (C<'>, C<">, C<`>) as delimiters for the quote-like operators. [Default severity 3] =head2 L Don't write C< print <<'__END__' >. [Default severity 3] =head2 L Don't use strings like C or C<1.4.5> when including other modules. [Default severity 3] =head2 L Require $VERSION to be a constant rather than a computed value. [Default severity 2] =head2 L Warns that you might have used single quotes when you really wanted double-quotes. [Default severity 1] =head2 L Write C< 141_234_397.0145 > instead of C< 141234397.0145 >. [Default severity 2] =head2 L Write C< print <<'THE_END' > or C< print <<"THE_END" >. [Default severity 3] =head2 L Write C< <<'THE_END'; > instead of C< <<'theEnd'; >. [Default severity 2] =head2 L Do not write C< my $foo .= 'bar'; >. [Default severity 4] =head2 L Do not write C< my $foo = $bar if $baz; >. [Default severity 5] =head2 L Ban variables that aren't blessed by your shop. [Default severity 5] =head2 L Use C instead of C, except when you have to. [Default severity 2] =head2 L Avoid C<$`>, C<$&>, C<$'> and their English equivalents. [Default severity 4] =head2 L Eliminate globals declared with C or C. [Default severity 3] =head2 L Use double colon (::) to separate package name components instead of single quotes ('). [Default severity 2] =head2 L Write C<$EVAL_ERROR> instead of C<$@>. [Default severity 2] =head2 L Do not reuse a variable name in a lexical scope [Default severity 3] =head2 L Don't ask for storage you don't need. [Default severity 3] =head2 L Prevent access to private vars in other packages. [Default severity 3] =head2 L Write C instead of just C. [Default severity 3] =head2 L Write C instead of C. [Default severity 5] =head2 L Magic variables should be assigned as "local". [Default severity 4] =head2 L Negative array index should be used. [Default severity 4] =head1 VERSION This is part of L version 1.126. =head1 AUTHOR Jeffrey Ryan Thalhammer =head1 COPYRIGHT Copyright (c) 2005-2011 Imaginative Software Systems. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. The full text of this license can be found in the LICENSE file included with this module. =cut