Login
Increased VERSION to 0.17
[gknop/Perl-Critic.git] / lib / Perl / Critic.pm
CommitLineData
aaa8512c
JRT
1#######################################################################
2# $URL$
3# $Date$
4# $Author$
5# $Revision$
6########################################################################
7
59b05e08
JRT
8package Perl::Critic;
9
10use strict;
11use warnings;
12use File::Spec;
4e771b0b 13use Scalar::Util qw(blessed);
59b05e08
JRT
14use English qw(-no_match_vars);
15use Perl::Critic::Config;
e01de056 16use Perl::Critic::Violation ();
59b05e08
JRT
17use Carp;
18use PPI;
19
08624963 20our $VERSION = '0.17';
a9c73f99 21$VERSION = eval $VERSION; ## no critic;
59b05e08
JRT
22
23#----------------------------------------------------------------------------
dff08b70 24
59b05e08 25sub new {
59b05e08 26 my ( $class, %args ) = @_;
dff08b70 27
e01de056 28 my $self = bless {}, $class;
1e7b8681 29 $self->{_force} = $args{-force} || 0;
e01de056 30 $self->{_top} = $args{-top} || 0;
1e7b8681 31 $self->{_config} = $args{-config} || Perl::Critic::Config->new( %args );
59b05e08
JRT
32 return $self;
33}
34
35#----------------------------------------------------------------------------
59b05e08 36
dff08b70
JRT
37sub config {
38 my $self = shift;
39 return $self->{_config};
40}
59b05e08 41
dff08b70 42#----------------------------------------------------------------------------
59b05e08 43
dff08b70
JRT
44sub add_policy {
45 my ( $self, @args ) = @_;
46 #Delegate to Perl::Critic::Config
47 return $self->config()->add_policy( @args );
48}
59b05e08 49
dff08b70
JRT
50#----------------------------------------------------------------------------
51
52sub policies {
53 my $self = shift;
54 #Delegate to Perl::Critic::Config
55 return $self->config()->policies();
59b05e08
JRT
56}
57
58#----------------------------------------------------------------------------
dff08b70 59
59b05e08 60sub critique {
7ed796a7 61
59b05e08
JRT
62 # Here we go!
63 my ( $self, $source_code ) = @_;
64
4e771b0b
JRT
65 # $source_code can be a file name, or a reference to a
66 # PPI::Document, or a reference to a scalar containing source
67 # code. In the last case, PPI handles the translation for us.
68 my $doc = ( blessed($source_code) && $source_code->isa('PPI::Document') ) ?
69 $source_code : PPI::Document->new($source_code);
59b05e08
JRT
70
71 # Bail on error
7ed796a7
JRT
72 if ( !defined $doc ) {
73 my $errstr = PPI::Document::errstr();
74 my $file = -f $source_code ? $source_code : 'stdin';
adc2e250 75 croak qq{Warning: Can't parse code: $errstr for '$file'};
59b05e08
JRT
76 }
77
78 # Pre-index location of each node (for speed)
79 $doc->index_locations();
80
1bef6e21
JRT
81 # Disable the magic shebang fix
82 my %is_line_disabled = _unfix_shebang($doc);
59b05e08 83
7ed796a7
JRT
84 # Filter exempt code, if desired
85 if ( !$self->{_force} ) {
c70a9ff6 86 my @site_policies = $self->config->site_policies();
1bef6e21
JRT
87 %is_line_disabled = ( %is_line_disabled,
88 _filter_code($doc, @site_policies) );
7ed796a7 89 }
1e7b8681 90
1bef6e21
JRT
91
92 # Seed a hash of PPI elements. Keys are PPI class names, and and
93 # values are arrayrefs containing all the instances of the class.
c70a9ff6
JRT
94 my %elements_of = ( 'PPI::Document' => [$doc],
95 'PPI::Element' => $doc->find('PPI::Element') || [], );
c70a9ff6 96
c70a9ff6 97
1bef6e21
JRT
98 my @violations = ();
99 for my $policy ( @{ $self->policies() } ) {
100
101 TYPE:
102 for my $type ( $policy->applies_to() ) {
103
104 # Gather up all the PPI elements that are of the $type
105 # that this $policy wants. Save them in a hash so we go
106 # only have to go searching for any given type once.
c70a9ff6
JRT
107
108 $elements_of{$type}
109 ||= [ grep {$_->isa($type)} @{ $elements_of{'PPI::Element'} } ];
110
c70a9ff6
JRT
111 ELEMENT:
112 for my $element ( @{ $elements_of{$type} } ) {
113
1bef6e21
JRT
114 # Evaulate the policy on this $element. A policy may
115 # return zero or more violations. We only want the
116 # violations that occur on lines that have not been
117 # disabled.
30e552bf 118
1bef6e21
JRT
119 VIOLATION:
120 for my $violation ( $policy->violates( $element, $doc ) ) {
121 my $policy_name = ref $policy;
ef22650a 122 my $loc = $violation->location();
1bef6e21
JRT
123 my $line = defined $loc ? $loc->[0] : 0; #See note [1]
124 next VIOLATION if $is_line_disabled{$line}->{$policy_name};
125 next VIOLATION if $is_line_disabled{$line}->{ALL};
ef22650a
CD
126 push @violations, $violation;
127 }
c70a9ff6 128 }
1bef6e21
JRT
129
130 # [1] Empty lists have an undef location. This is an
131 # unresolved bug in PPI, which is documented here:
132 # http://sourceforge.net/mailarchive/forum.php?thread_id=9684490&forum_id=45571
133 # So I'm just trying to avoid derefencing an undef value.
134
bf159007
JRT
135 }
136 }
c70a9ff6 137
e01de056
JRT
138 # If requested, rank violations by their severity and only return
139 # the top N violations. This used to be handled by 'perlcritic'
140 # but I moved it into the library to give the Perl::Critic API
141 # more flexibility and functionality.
142
143 if ( @violations && (my $top = $self->{_top}) ) {
144 my $limit = @violations < $top ? $#violations : $top-1;
145 @violations = Perl::Critic::Violation::sort_by_severity(@violations);
146 @violations = ( reverse @violations )[ 0 .. $limit ]; #Slicing...
147 }
148
7ed796a7 149 return Perl::Critic::Violation->sort_by_location(@violations);
59b05e08
JRT
150}
151
59b05e08
JRT
152#============================================================================
153#PRIVATE SUBS
154
155sub _filter_code {
156
c70a9ff6 157 my ($doc, @site_policies)= @_;;
59b05e08
JRT
158 my $nodes_ref = $doc->find('PPI::Token::Comment') || return;
159 my $no_critic = qr{\A \s* \#\# \s* no \s+ critic}mx;
160 my $use_critic = qr{\A \s* \#\# \s* use \s+ critic}mx;
7ed796a7
JRT
161 my %disabled_lines;
162
59b05e08
JRT
163 PRAGMA:
164 for my $pragma ( grep { $_ =~ $no_critic } @{$nodes_ref} ) {
165
c70a9ff6
JRT
166 # Parse out the list of Policy names after the
167 # 'no critic' pragma. I'm thinking of this just
168 # like a an C<import> argument for real pragmas.
169 my @no_policies = _parse_nocritic_import($pragma, @site_policies);
170
171 # Grab surrounding nodes to determine the context.
172 # This determines whether the pragma applies to
173 # the current line or the block that follows.
209eb6db
JRT
174 my $parent = $pragma->parent();
175 my $grandparent = $parent ? $parent->parent() : undef;
176 my $sib = $pragma->sprevious_sibling();
177
c70a9ff6 178
209eb6db
JRT
179 # Handle single-line usage on simple statements
180 if ( $sib && $sib->location->[0] == $pragma->location->[0] ) {
c70a9ff6
JRT
181 my $line = $pragma->location->[0];
182 for my $policy ( @no_policies ) {
183 $disabled_lines{ $line }->{$policy} = 1;
184 }
209eb6db
JRT
185 next PRAGMA;
186 }
187
188
189 # Handle single-line usage on compound statements
190 if ( ref $parent eq 'PPI::Structure::Block' ) {
5c1bf20d
JRT
191 if ( ref $grandparent eq 'PPI::Statement::Compound'
192 || ref $grandparent eq 'PPI::Statement::Sub' ) {
209eb6db 193 if ( $parent->location->[0] == $pragma->location->[0] ) {
c70a9ff6
JRT
194 my $line = $grandparent->location->[0];
195 for my $policy ( @no_policies ) {
196 $disabled_lines{ $line }->{$policy} = 1;
197 }
209eb6db
JRT
198 next PRAGMA;
199 }
59b05e08
JRT
200 }
201 }
202
209eb6db
JRT
203
204 # Handle multi-line usage. This is either a "no critic" ..
205 # "use critic" region or a block where "no critic" persists
206 # until the end of the scope. The start is the always the "no
207 # critic" which we already found. So now we have to search
208 # for the end.
7ed796a7
JRT
209
210 my $start = $pragma;
211 my $end = $pragma;
212
59b05e08 213 SIB:
7ed796a7
JRT
214 while ( my $sib = $end->next_sibling() ) {
215 $end = $sib; # keep track of last sibling encountered in this scope
216 last SIB
c70a9ff6 217 if $sib->isa('PPI::Token::Comment') && $sib =~ $use_critic;
7ed796a7
JRT
218 }
219
220 # We either found an end or hit the end of the scope.
221 # Flag all intervening lines
222 for my $line ( $start->location->[0] .. $end->location->[0] ) {
c70a9ff6
JRT
223 for my $policy ( @no_policies ) {
224 $disabled_lines{ $line }->{$policy} = 1;
225 }
59b05e08 226 }
59b05e08 227 }
dff08b70 228
7ed796a7 229 return %disabled_lines;
59b05e08 230}
dff08b70 231
7ed796a7
JRT
232#----------------------------------------------------------------------------
233
c70a9ff6
JRT
234sub _parse_nocritic_import {
235
c48094aa 236 my ($pragma, @site_policies) = @_;
c70a9ff6 237
c48094aa 238 my $module = qr{ [\w:]+ }mx;
57c51ff5 239 my $delim = qr{ \s* [,\s] \s* }mx;
c0137eab 240 my $qw = qr{ (?: qw )? }mx;
57c51ff5 241 my $qualifier = qr{ $qw \( \s* ( $module \s* (?: $delim $module)* ) \s* \) }mx;
c48094aa 242 my $no_critic = qr{ \A \s* \#\# \s* no \s+ critic \s* $qualifier }mx;
1bef6e21 243
c48094aa 244 if ( my ($module_list) = $pragma =~ $no_critic ) {
c0137eab 245 my @modules = split $delim, $module_list;
c48094aa 246 return map { my $req = $_; grep {m/$req/imx} @site_policies } @modules;
c70a9ff6
JRT
247 }
248
a9c73f99 249 # Default to disabling ALL policies.
c70a9ff6
JRT
250 return qw(ALL);
251}
252
253#----------------------------------------------------------------------------
59b05e08
JRT
254sub _unfix_shebang {
255
7ed796a7
JRT
256 #When you install a script using ExtUtils::MakeMaker or
257 #Module::Build, it inserts some magical code into the top of the
258 #file (just after the shebang). This code allows people to call
259 #your script using a shell, like `sh my_script`. Unfortunately,
260 #this code causes several Policy violations, so we just remove it.
59b05e08 261
7ed796a7 262 my $doc = shift;
59b05e08
JRT
263 my $first_stmnt = $doc->schild(0) || return;
264
7ed796a7
JRT
265 #Different versions of MakeMaker and Build use slightly differnt
266 #shebang fixing strings. This matches most of the ones I've found
267 #in my own Perl distribution, but it may not be bullet-proof.
59b05e08
JRT
268
269 my $fixin_rx = qr{^eval 'exec .* \$0 \${1\+"\$@"}'\s*[\r\n]\s*if.+;};
7ed796a7 270 if ( $first_stmnt =~ $fixin_rx ) {
1bef6e21 271 my $line = $first_stmnt->location()->[0];
c70a9ff6 272 return ( $line => {ALL => 1}, $line + 1 => {ALL => 1} );
7ed796a7 273 }
dff08b70 274
1bef6e21 275 #No magic shebang was found!
7ed796a7 276 return;
59b05e08
JRT
277}
278
2791;
280
281#----------------------------------------------------------------------------
282
283__END__
284
285=pod
286
821d0eb5
CD
287=for stopwords DGR INI-style
288
59b05e08
JRT
289=head1 NAME
290
6ef8f5d3 291Perl::Critic - Critique Perl source code for best-practices
59b05e08
JRT
292
293=head1 SYNOPSIS
294
295 use Perl::Critic;
6bf9b465
JRT
296 my $file = shift;
297 my $critic = Perl::Critic->new();
298 my @violations = $critic->critique($file);
299 print @violations;
59b05e08
JRT
300
301=head1 DESCRIPTION
302
303Perl::Critic is an extensible framework for creating and applying
304coding standards to Perl source code. Essentially, it is a static
305source code analysis engine. Perl::Critic is distributed with a
306number of L<Perl::Critic::Policy> modules that attempt to enforce
1e7b8681 307various coding guidelines. Most Policy modules are based on Damian
7577ffae
JRT
308Conway's book B<Perl Best Practices>. However, Perl::Critic is B<not>
309limited to PBP and will even support Policies that contradict Conway.
310You can enable, disable, and customize those Polices through the
311Perl::Critic interface. You can also create new Policy modules that
312suit your own tastes.
59b05e08
JRT
313
314For a convenient command-line interface to Perl::Critic, see the
315documentation for L<perlcritic>. If you want to integrate
1e7b8681 316Perl::Critic with your build process, L<Test::Perl::Critic> provides
0304068a
JRT
317an interface that is suitable for test scripts. For the ultimate
318convenience (at the expense of some flexibility) see the L<criticism>
319pragma.
320
821d0eb5 321Win32 and ActivePerl users can find PPM distributions of Perl::Critic
0304068a 322at L<http://theoryx5.uwinnipeg.ca/ppms/>.
59b05e08
JRT
323
324=head1 CONSTRUCTOR
325
326=over 8
327
e01de056 328=item C<new( -profile =E<gt> $FILE, -severity =E<gt> $N, -include =E<gt> \@PATTERNS, -exclude =E<gt> \@PATTERNS, -top => N, -force =E<gt> 1 )>
59b05e08
JRT
329
330Returns a reference to a new Perl::Critic object. Most arguments are
331just passed directly into L<Perl::Critic::Config>, but I have described
332them here as well. All arguments are optional key-value pairs as
333follows:
334
335B<-profile> is a path to a configuration file. If C<$FILE> is not
336defined, Perl::Critic::Config attempts to find a F<.perlcriticrc>
337configuration file in the current directory, and then in your home
338directory. Alternatively, you can set the C<PERLCRITIC> environment
339variable to point to a file in another location. If a configuration
6bf9b465
JRT
340file can't be found, or if C<$FILE> is an empty string, then all
341Policies will be loaded with their default configuration. See
342L<"CONFIGURATION"> for more information.
1e7b8681
JRT
343
344B<-severity> is the minimum severity level. Only Policy modules that
6bf9b465
JRT
345have a severity greater than C<$N> will be loaded. Severity values
346are integers ranging from 1 (least severe) to 5 (most severe). The
347default is 5. For a given C<-profile>, decreasing the C<-severity>
348will usually result in more Policy violations. Users can redefine the
349severity level for any Policy in their F<.perlcriticrc> file. See
350L<"CONFIGURATION"> for more information.
351
352B<-include> is a reference to a list of string C<@PATTERNS>. Policy
353modules that match at least one C<m/$PATTERN/imx> will always be
354loaded, irrespective of the severity settings. For example:
355
356 my $critic = Perl::Critic->new(-include => ['layout'] -severity => 4);
357
358This would cause Perl::Critic to load all the C<CodeLayout::*> Policy
359modules even though they have a severity level that is less than 4.
360You can use C<-include> in conjunction with the C<-exclude> option.
361Note that C<-exclude> takes precedence over C<-include> when a Policy
362matches both patterns.
363
364B<-exclude> is a reference to a list of string C<@PATTERNS>. Policy
365modules that match at least one C<m/$PATTERN/imx> will not be loaded,
366irrespective of the severity settings. For example:
367
368 my $critic = Perl::Critic->new(-exclude => ['strict'] -severity => 1);
369
370This would cause Perl::Critic to not load the C<RequireUseStrict> and
371C<ProhibitNoStrict> Policy modules even though they have a severity
372level that is greater than 1. You can use C<-exclude> in conjunction
373with the C<-include> option. Note that C<-exclude> takes precedence
374over C<-include> when a Policy matches both patterns.
375
e01de056
JRT
376B<-top> is the maximum number of Violations to return when ranked by
377their severity levels. Violations are still returned in the order
378that they occur within the file. This must be a positive integer
379
6bf9b465 380B<-force> controls whether Perl::Critic observes the magical C<"## no
59b05e08
JRT
381critic"> pseudo-pragmas in your code. If set to a true value,
382Perl::Critic will analyze all code. If set to a false value (which is
6bf9b465 383the default) Perl::Critic will ignore code that is tagged with these
59b05e08
JRT
384comments. See L<"BENDING THE RULES"> for more information.
385
58e3f828 386B<-config> is a reference to a L<Perl::Critic::Config> object. If you
6bf9b465
JRT
387have created your own Config object for some reason, you can pass it
388in here instead of having Perl::Critic create one for you. Using the
54c10e6b 389C<-config> option causes all the other options to be silently ignored.
58e3f828 390
59b05e08
JRT
391=back
392
393=head1 METHODS
394
395=over 8
396
6d9feae6 397=item C<critique( $source_code )>
1e7b8681
JRT
398
399Runs the C<$source_code> through the Perl::Critic engine using all the
400Policies that have been loaded into this engine. If C<$source_code>
401is a scalar reference, then it is treated as string of actual Perl
4e771b0b
JRT
402code. If C<$source_code> is a reference to an instance of
403L<PPI::Document>, then that instance is used directly. Otherwise, it
404is treated as a path to a local file containing Perl code. This
405method Returns a list of L<Perl::Critic::Violation> objects for each
1e7b8681
JRT
406violation of the loaded Policies. The list is sorted in the order
407that the Violations appear in the code. If there are no violations,
4e771b0b 408this method returns an empty list.
1e7b8681 409
a1f26155 410=item C<add_policy( -policy =E<gt> $policy_name, -config =E<gt> \%config_hash )>
59b05e08 411
54c10e6b 412Creates a Policy object and loads it into this Critic. If the object
1e7b8681 413cannot be instantiated, it will throw a warning and return a false
6bf9b465 414value. Otherwise, it returns a reference to this Critic.
59b05e08
JRT
415
416B<-policy> is the name of a L<Perl::Critic::Policy> subclass
417module. The C<'Perl::Critic::Policy'> portion of the name can be
418omitted for brevity. This argument is required.
419
420B<-config> is an optional reference to a hash of Policy configuration
54c10e6b 421parameters. Note that this is B<not> the same thing as a
f8966b15 422L<Perl::Critic::Config> object. The contents of this hash reference
54c10e6b
JRT
423will be passed into to the constructor of the Policy module. See the
424documentation in the relevant Policy module for a description of the
425arguments it supports.
59b05e08 426
6d9feae6 427=item C<policies()>
59b05e08
JRT
428
429Returns a list containing references to all the Policy objects that
430have been loaded into this engine. Objects will be in the order that
431they were loaded.
432
6d9feae6 433=item C<config()>
dff08b70 434
54c10e6b
JRT
435Returns the L<Perl::Critic::Config> object that was created for or given
436to this Critic.
dff08b70 437
59b05e08
JRT
438=back
439
440=head1 CONFIGURATION
441
442The default configuration file is called F<.perlcriticrc>.
1e7b8681
JRT
443Perl::Critic will look for this file in the current directory first,
444and then in your home directory. Alternatively, you can set the
445PERLCRITIC environment variable to explicitly point to a different
59b05e08 446file in another location. If none of these files exist, and the
1e7b8681
JRT
447C<-profile> option is not given to the constructor, then all the
448modules that are found in the Perl::Critic::Policy namespace will be
449loaded with their default configuration.
59b05e08 450
6bf9b465
JRT
451The format of the configuration file is a series of INI-style sections
452that contain key-value pairs separated by '='. Comments should start
453with '#' and can be placed on a separate line or after the name-value
454pairs if you desire. The general recipe is a series of blocks like
455this:
59b05e08 456
7ed796a7
JRT
457 [Perl::Critic::Policy::Category::PolicyName]
458 severity = 1
459 arg1 = value1
460 arg2 = value2
59b05e08
JRT
461
462C<Perl::Critic::Policy::Category::PolicyName> is the full name of a
463module that implements the policy. The Policy modules distributed
464with Perl::Critic have been grouped into categories according to the
465table of contents in Damian Conway's book B<Perl Best Practices>. For
b2c7354a 466brevity, you can omit the C<'Perl::Critic::Policy'> part of the
6bf9b465 467module name.
59b05e08 468
1e7b8681
JRT
469C<severity> is the level of importance you wish to assign to the
470Policy. All Policy modules are defined with a default severity value
471ranging from 1 (least severe) to 5 (most severe). However, you may
472disagree with the default severity and choose to give it a higher or
473lower severity, based on your own coding philosophy.
59b05e08 474
b87b00dd
JRT
475The remaining key-value pairs are configuration parameters that will
476be passed into the constructor for that Policy. The constructors for
477most Policy objects do not support arguments, and those that do should
6bf9b465
JRT
478have reasonable defaults. See the documentation on the appropriate
479Policy module for more details.
59b05e08 480
6bf9b465
JRT
481Instead of redefining the severity for a given Policy, you can
482completely disable a Policy by prepending a '-' to the name of the
483module in your configuration file. In this manner, the Policy will
484never be loaded, regardless of the C<-severity> given to the
485Perl::Critic constructor.
59b05e08
JRT
486
487A simple configuration might look like this:
488
7ed796a7
JRT
489 #--------------------------------------------------------------
490 # I think these are really important, so always load them
59b05e08 491
3878b20f 492 [TestingAndDebugging::RequireUseStrict]
7ed796a7 493 severity = 5
59b05e08 494
3878b20f 495 [TestingAndDebugging::RequireUseWarnings]
7ed796a7 496 severity = 5
59b05e08 497
7ed796a7
JRT
498 #--------------------------------------------------------------
499 # I think these are less important, so only load when asked
59b05e08 500
7ed796a7
JRT
501 [Variables::ProhibitPackageVars]
502 severity = 2
59b05e08 503
7ed796a7
JRT
504 [ControlStructures::ProhibitPostfixControls]
505 allow = if unless #My custom configuration
506 severity = 2
59b05e08 507
7ed796a7
JRT
508 #--------------------------------------------------------------
509 # I do not agree with these at all, so never load them
59b05e08 510
7ed796a7
JRT
511 [-NamingConventions::ProhibitMixedCaseVars]
512 [-NamingConventions::ProhibitMixedCaseSubs]
59b05e08 513
7ed796a7
JRT
514 #--------------------------------------------------------------
515 # For all other Policies, I accept the default severity,
516 # so no additional configuration is required for them.
1e7b8681 517
8bc162ba 518
6bf9b465
JRT
519A few sample configuration files are included in this distribution
520under the F<t/samples> directory. The F<perlcriticrc.none> file
521demonstrates how to disable Policy modules. The
522F<perlcriticrc.levels> file demonstrates how to redefine the severity
523level for any given Policy module. The F<perlcriticrc.pbp> file
524configures Perl::Critic to load only Policies described in Damian
525Conway's book "Perl Best Practice."
526
59b05e08
JRT
527=head1 THE POLICIES
528
529The following Policy modules are distributed with Perl::Critic. The
530Policy modules have been categorized according to the table of
531contents in Damian Conway's book B<Perl Best Practices>. Since most
532coding standards take the form "do this..." or "don't do that...", I
533have adopted the convention of naming each module C<RequireSomething>
8bc162ba
JRT
534or C<ProhibitSomething>. Each Policy is listed here with it's default
535severity. If you don't agree with the default severity, you can
536change it in your F<.perlcriticrc> file. See the documentation of
537each module for it's specific details.
59b05e08
JRT
538
539=head2 L<Perl::Critic::Policy::BuiltinFunctions::ProhibitLvalueSubstr>
540
8bc162ba 541Use 4-argument C<substr> instead of writing C<substr($foo, 2, 6) = $bar> [Severity 3]
59b05e08
JRT
542
543=head2 L<Perl::Critic::Policy::BuiltinFunctions::ProhibitSleepViaSelect>
544
8bc162ba 545Use L<Time::HiRes> instead of something like C<select(undef, undef, undef, .05)> [Severity 5]
59b05e08
JRT
546
547=head2 L<Perl::Critic::Policy::BuiltinFunctions::ProhibitStringyEval>
548
8bc162ba 549Write C<eval { my $foo; bar($foo) }> instead of C<eval "my $foo; bar($foo);"> [Severity 5]
59b05e08 550
7d2c51b1
CD
551=head2 L<Perl::Critic::Policy::BuiltinFunctions::ProhibitUniversalCan>
552
da45cfe0 553Write C<< eval { $foo->can($name) } >> instead of C<UNIVERSAL::can($foo, $name)> [Severity 3]
7d2c51b1
CD
554
555=head2 L<Perl::Critic::Policy::BuiltinFunctions::ProhibitUniversalIsa>
556
da45cfe0 557Write C<< eval { $foo->isa($pkg) } >> instead of C<UNIVERSAL::isa($foo, $pkg)> [Severity 3]
7d2c51b1 558
59b05e08
JRT
559=head2 L<Perl::Critic::Policy::BuiltinFunctions::RequireBlockGrep>
560
8bc162ba 561Write C<grep { $_ =~ /$pattern/ } @list> instead of C<grep /$pattern/, @list> [Severity 4]
59b05e08
JRT
562
563=head2 L<Perl::Critic::Policy::BuiltinFunctions::RequireBlockMap>
564
8bc162ba 565Write C<map { $_ =~ /$pattern/ } @list> instead of C<map /$pattern/, @list> [Severity 4]
59b05e08
JRT
566
567=head2 L<Perl::Critic::Policy::BuiltinFunctions::RequireGlobFunction>
568
8bc162ba 569Use C<glob q{*}> instead of <*> [Severity 5]
59b05e08 570
fc1186f9
CD
571=head2 L<Perl::Critic::Policy::ClassHierarchies::ProhibitExplicitISA>
572
573Employ C<use base> instead of C<@ISA> [Severity 3]
574
59b05e08
JRT
575=head2 L<Perl::Critic::Policy::ClassHierarchies::ProhibitOneArgBless>
576
8bc162ba 577Write C<bless {}, $class;> instead of just C<bless {};> [Severity 5]
59b05e08
JRT
578
579=head2 L<Perl::Critic::Policy::CodeLayout::ProhibitHardTabs>
580
8bc162ba 581Use spaces instead of tabs. [Severity 3]
59b05e08
JRT
582
583=head2 L<Perl::Critic::Policy::CodeLayout::ProhibitParensWithBuiltins>
584
8bc162ba 585Write C<open $handle, $path> instead of C<open($handle, $path)> [Severity 1]
59b05e08
JRT
586
587=head2 L<Perl::Critic::Policy::CodeLayout::ProhibitQuotedWordLists>
588
8bc162ba 589Write C<qw(foo bar baz)> instead of C<('foo', 'bar', 'baz')> [Severity 2]
59b05e08
JRT
590
591=head2 L<Perl::Critic::Policy::CodeLayout::RequireTidyCode>
592
8bc162ba 593Must run code through L<perltidy>. [Severity 1]
59b05e08
JRT
594
595=head2 L<Perl::Critic::Policy::CodeLayout::RequireTrailingCommas>
596
8bc162ba 597Put a comma at the end of every multi-line list declaration, including the last one. [Severity 1]
59b05e08
JRT
598
599=head2 L<Perl::Critic::Policy::ControlStructures::ProhibitCascadingIfElse>
600
8bc162ba 601Don't write long "if-elsif-elsif-elsif-elsif...else" chains. [Severity 3]
59b05e08
JRT
602
603=head2 L<Perl::Critic::Policy::ControlStructures::ProhibitCStyleForLoops>
604
8bc162ba 605Write C<for(0..20)> instead of C<for($i=0; $i<=20; $i++)> [Severity 2]
59b05e08
JRT
606
607=head2 L<Perl::Critic::Policy::ControlStructures::ProhibitPostfixControls>
608
8bc162ba 609Write C<if($condition){ do_something() }> instead of C<do_something() if $condition> [Severity 2]
59b05e08
JRT
610
611=head2 L<Perl::Critic::Policy::ControlStructures::ProhibitUnlessBlocks>
612
8bc162ba 613Write C<if(! $condition)> instead of C<unless($condition)> [Severity 2]
59b05e08 614
4f7da5f8
JRT
615=head2 L<Perl::Critic::Policy::ControlStructures::ProhibitUnreachableCode>
616
617Don't write code after an unconditional C<die, exit, or next>. [Severity 4]
618
59b05e08
JRT
619=head2 L<Perl::Critic::Policy::ControlStructures::ProhibitUntilBlocks>
620
8bc162ba 621Write C<while(! $condition)> instead of C<until($condition)> [Severity 2]
59b05e08 622
8de08c2e
CD
623=head2 L<Perl::Critic::Policy::Documentation::RequirePodAtEnd>
624
625All POD should be after C<__END__> [Severity 1]
626
c169e1bd
JRT
627=head2 L<Perl::Critic::Policy::Documentation::RequirePodSections>
628
629Organize your POD into the customary sections. [Severity 2]
630
59b05e08
JRT
631=head2 L<Perl::Critic::Policy::InputOutput::ProhibitBacktickOperators>
632
8bc162ba 633Discourage stuff like C<@files = `ls $directory`> [Severity 3]
59b05e08
JRT
634
635=head2 L<Perl::Critic::Policy::InputOutput::ProhibitBarewordFileHandles>
636
8bc162ba 637Write C<open my $fh, q{<}, $filename;> instead of C<open FH, q{<}, $filename;> [Severity 5]
59b05e08
JRT
638
639=head2 L<Perl::Critic::Policy::InputOutput::ProhibitOneArgSelect>
640
8bc162ba 641Never write C<select($fh)> [Severity 4]
59b05e08 642
013195d6
JRT
643=head2 L<Perl::Critic::Policy::InputOutput::ProhibitReadlineInForLoop>
644
da45cfe0 645Write C<< while( $line = <> ){...} >> instead of C<< for(<>){...} >> [Severity 4]
013195d6 646
59b05e08
JRT
647=head2 L<Perl::Critic::Policy::InputOutput::ProhibitTwoArgOpen>
648
da45cfe0 649Write C<< open $fh, q{<}, $filename; >> instead of C<< open $fh, "<$filename"; >> [Severity 5]
59b05e08 650
9abb896e
JRT
651=head2 L<Perl::Critic::Policy::InputOutput::RequireBracedFileHandleWithPrint>
652
653Write C<print {$FH} $foo, $bar;> instead of C<print $FH $foo, $bar;> [Severity 1]
654
f8966b15
JRT
655=head2 L<Perl::Critic::Policy::Miscellanea::ProhibitFormats>
656
657Do not use C<format>. [Severity 3]
658
659=head2 L<Perl::Critic::Policy::Miscellanea::ProhibitTies>
660
661Do not use C<tie>. [Severity 2]
662
59b05e08
JRT
663=head2 L<Perl::Critic::Policy::Miscellanea::RequireRcsKeywords>
664
8bc162ba 665Put source-control keywords in every file. [Severity 2]
59b05e08 666
4e771b0b
JRT
667=head2 L<Perl::Critic::Policy::Modules::ProhibitAutomaticExportation>
668
669Export symbols via C<@EXPORT_OK> or C<%EXPORT_TAGS> instead of C<@EXPORT>. [Severity 3]
670
59b05e08
JRT
671=head2 L<Perl::Critic::Policy::Modules::ProhibitMultiplePackages>
672
8bc162ba 673Put packages (especially subclasses) in separate files. [Severity 4]
59b05e08
JRT
674
675=head2 L<Perl::Critic::Policy::Modules::RequireBarewordIncludes>
676
8bc162ba 677Write C<require Module> instead of C<require 'Module.pm'> [Severity 5]
59b05e08 678
ad77f8eb 679=head2 L<Perl::Critic::Policy::Modules::ProhibitEvilModules>
59b05e08 680
8bc162ba 681Ban modules that aren't blessed by your shop. [Severity 5]
59b05e08
JRT
682
683=head2 L<Perl::Critic::Policy::Modules::RequireExplicitPackage>
684
8bc162ba 685Always make the C<package> explicit. [Severity 4]
59b05e08
JRT
686
687=head2 L<Perl::Critic::Policy::Modules::RequireVersionVar>
688
8bc162ba 689Give every module a C<$VERSION> number. [Severity 2]
59b05e08 690
ad77f8eb 691=head2 L<Perl::Critic::Policy::Modules::RequireEndWithOne>
59b05e08 692
b2c7354a 693End each module with an explicitly C<1;> instead of some funky expression. [Severity 4]
59b05e08 694
ad77f8eb 695=head2 L<Perl::Critic::Policy::NamingConventions::ProhibitAmbiguousNames>
59b05e08 696
8bc162ba 697Don't use vague variable or subroutine names like 'last' or 'record'. [Severity 3]
59b05e08
JRT
698
699=head2 L<Perl::Critic::Policy::NamingConventions::ProhibitMixedCaseSubs>
700
8bc162ba 701Write C<sub my_function{}> instead of C<sub MyFunction{}> [Severity 1]
59b05e08
JRT
702
703=head2 L<Perl::Critic::Policy::NamingConventions::ProhibitMixedCaseVars>
704
8bc162ba 705Write C<$my_variable = 42> instead of C<$MyVariable = 42> [Severity 1]
59b05e08 706
8bc162ba 707=head2 L<Perl::Critic::Policy::References::ProhibitDoubleSigils>
ad77f8eb 708
8bc162ba 709Write C<@{ $array_ref }> instead of C<@$array_ref> [Severity 2]
ad77f8eb 710
8bc162ba 711=head2 L<Perl::Critic::Policy::RegularExpressions::RequireLineBoundaryMatching>
ad77f8eb 712
8bc162ba 713Always use the C</m> modifier with regular expressions. [Severity 3]
ad77f8eb 714
8bc162ba 715=head2 L<Perl::Critic::Policy::RegularExpressions::RequireExtendedFormatting>
ad77f8eb 716
8bc162ba 717Always use the C</x> modifier with regular expressions. [Severity 2]
ad77f8eb
JRT
718
719=head2 L<Perl::Critic::Policy::Subroutines::ProhibitAmpersandSigils>
720
8bc162ba 721Don't call functions with a leading ampersand sigil. [Severity 2]
ad77f8eb 722
59b05e08
JRT
723=head2 L<Perl::Critic::Policy::Subroutines::ProhibitBuiltinHomonyms>
724
8bc162ba 725Don't declare your own C<open> function. [Severity 4]
59b05e08 726
ad77f8eb
JRT
727=head2 L<Perl::Critic::Policy::Subroutines::ProhibitExcessComplexity>
728
8bc162ba 729Minimize complexity by factoring code into smaller subroutines. [Severity 3]
ad77f8eb 730
59b05e08
JRT
731=head2 L<Perl::Critic::Policy::Subroutines::ProhibitExplicitReturnUndef>
732
8bc162ba 733Return failure with bare C<return> instead of C<return undef> [Severity 5]
59b05e08
JRT
734
735=head2 L<Perl::Critic::Policy::Subroutines::ProhibitSubroutinePrototypes>
736
8bc162ba 737Don't write C<sub my_function (@@) {}> [Severity 5]
59b05e08 738
38ce10c1
CD
739=head2 L<Perl::Critic::Policy::Subroutines::ProtectPrivateSubs>
740
741Prevent access to private subs in other packages [Severity 3]
742
ad77f8eb
JRT
743=head2 L<Perl::Critic::Policy::Subroutines::RequireFinalReturn>
744
8bc162ba 745End every path through a subroutine with an explicit C<return> statement. [Severity 4]
ad77f8eb 746
3878b20f 747=head2 L<Perl::Critic::Policy::TestingAndDebugging::ProhibitNoStrict>
ad77f8eb 748
8bc162ba 749Prohibit various flavors of C<no strict> [Severity 5]
ad77f8eb 750
3878b20f 751=head2 L<Perl::Critic::Policy::TestingAndDebugging::ProhibitNoWarnings>
ad77f8eb 752
8bc162ba 753Prohibit various flavors of C<no warnings> [Severity 4]
ad77f8eb 754
3878b20f 755=head2 L<Perl::Critic::Policy::TestingAndDebugging::RequireUseStrict>
59b05e08 756
8bc162ba 757Always C<use strict> [Severity 5]
59b05e08 758
3878b20f 759=head2 L<Perl::Critic::Policy::TestingAndDebugging::RequireUseWarnings>
59b05e08 760
8bc162ba 761Always C<use warnings> [Severity 4]
59b05e08
JRT
762
763=head2 L<Perl::Critic::Policy::ValuesAndExpressions::ProhibitConstantPragma>
764
da45cfe0 765Don't C<< use constant $FOO => 15 >> [Severity 4]
59b05e08
JRT
766
767=head2 L<Perl::Critic::Policy::ValuesAndExpressions::ProhibitEmptyQuotes>
768
8bc162ba 769Write C<q{}> instead of C<''> [Severity 2]
59b05e08
JRT
770
771=head2 L<Perl::Critic::Policy::ValuesAndExpressions::ProhibitInterpolationOfLiterals>
772
8bc162ba 773Always use single quotes for literal strings. [Severity 1]
59b05e08
JRT
774
775=head2 L<Perl::Critic::Policy::ValuesAndExpressions::ProhibitLeadingZeros>
776
8bc162ba 777Write C<oct(755)> instead of C<0755> [Severity 5]
59b05e08 778
e7ff023b
JRT
779=head2 L<Perl::Critic::Policy::ValuesAndExpressions::ProhibitMixedBooleanOperators>
780
50a6ad85 781Write C< !$foo && $bar || $baz > instead of C< not $foo && $bar or $baz> [Severity 4]
e7ff023b 782
59b05e08
JRT
783=head2 L<Perl::Critic::Policy::ValuesAndExpressions::ProhibitNoisyQuotes>
784
8bc162ba 785Use C<q{}> or C<qq{}> instead of quotes for awkward-looking strings. [Severity 2]
59b05e08 786
4e771b0b
JRT
787=head2 L<Perl::Critic::Policy::ValuesAndExpressions::ProhibitVersionStrings>
788
789Don't use strings like C<v1.4> or C<1.4.5> when including other modules. [Severity 3]
790
59b05e08
JRT
791=head2 L<Perl::Critic::Policy::ValuesAndExpressions::RequireInterpolationOfMetachars>
792
8bc162ba 793Warns that you might have used single quotes when you really wanted double-quotes. [Severity 1]
59b05e08
JRT
794
795=head2 L<Perl::Critic::Policy::ValuesAndExpressions::RequireNumberSeparators>
796
8bc162ba 797Write C< 141_234_397.0145 > instead of C< 141234397.0145 > [Severity 2]
59b05e08
JRT
798
799=head2 L<Perl::Critic::Policy::ValuesAndExpressions::RequireQuotedHeredocTerminator>
800
8bc162ba 801Write C< print <<'THE_END' > or C< print <<"THE_END" > [Severity 3]
59b05e08
JRT
802
803=head2 L<Perl::Critic::Policy::ValuesAndExpressions::RequireUpperCaseHeredocTerminator>
804
8bc162ba 805Write C< <<'THE_END'; > instead of C< <<'theEnd'; > [Severity 1]
59b05e08 806
f8966b15
JRT
807=head2 L<Perl::Critic::Policy::Variables::ProhibitConditionalDeclarations>
808
809Do not write C< my $foo = $bar if $baz; > [Severity 5]
810
59b05e08
JRT
811=head2 L<Perl::Critic::Policy::Variables::ProhibitLocalVars>
812
8bc162ba 813Use C<my> instead of C<local>, except when you have to. [Severity 2]
59b05e08 814
b672fd9e
CD
815=head2 L<Perl::Critic::Policy::Variables::ProhibitMatchVars>
816
817Avoid C<$`>, C<$&>, C<$'> and their English equivalents. [Severity 4]
818
59b05e08
JRT
819=head2 L<Perl::Critic::Policy::Variables::ProhibitPackageVars>
820
8bc162ba 821Eliminate globals declared with C<our> or C<use vars> [Severity 3]
59b05e08
JRT
822
823=head2 L<Perl::Critic::Policy::Variables::ProhibitPunctuationVars>
824
8bc162ba 825Write C<$EVAL_ERROR> instead of C<$@> [Severity 2]
59b05e08 826
38ce10c1
CD
827=head2 L<Perl::Critic::Policy::Variables::ProtectPrivateVars>
828
829Prevent access to private vars in other packages [Severity 3]
830
e7ff023b
JRT
831=head2 L<Perl::Critic::Policy::Variables::RequireInitializationForLocalVars>
832
833Write C<local $foo = $bar;> instead of just C<local $foo;> [Severity 3]
38ce10c1 834
59b05e08
JRT
835=head1 BENDING THE RULES
836
59b05e08
JRT
837Perl::Critic takes a hard-line approach to your code: either you
838comply or you don't. In the real world, it is not always practical
839(or even possible) to fully comply with coding standards. In such
840cases, it is wise to show that you are knowingly violating the
841standards and that you have a Damn Good Reason (DGR) for doing so.
842
843To help with those situations, you can direct Perl::Critic to ignore
844certain lines or blocks of code by using pseudo-pragmas:
845
846 require 'LegacyLibaray1.pl'; ## no critic
847 require 'LegacyLibrary2.pl'; ## no critic
848
849 for my $element (@list) {
850
851 ## no critic
852
853 $foo = ""; #Violates 'ProhibitEmptyQuotes'
854 $barf = bar() if $foo; #Violates 'ProhibitPostfixControls'
855 #Some more evil code...
856
857 ## use critic
858
859 #Some good code...
860 do_something($_);
861 }
862
6bf9b465 863The C<"## no critic"> comments direct Perl::Critic to ignore the
59b05e08
JRT
864remaining lines of code until the end of the current block, or until a
865C<"## use critic"> comment is found (whichever comes first). If the
866C<"## no critic"> comment is on the same line as a code statement,
867then only that line of code is overlooked. To direct perlcritic to
868ignore the C<"## no critic"> comments, use the C<-force> option.
869
1bef6e21
JRT
870A bare C<"## no critic"> comment disables all the active Policies. If
871you wish to disable only specific Policies, add a list of Policy names
872as arguments just as you would for the C<"no strict"> or C<"no
873warnings"> pragmas. For example, this would disable the
874C<ProhibitEmptyQuotes> and C<ProhibitPostfixControls> policies until
875the end of the block or until the next C<"## use critic"> comment
876(whichever comes first):
c70a9ff6 877
c48094aa 878 ## no critic (EmptyQuotes, PostfixControls)
c70a9ff6
JRT
879
880 $foo = ""; #Now exempt from ValuesAndExpressions::ProhibitEmptyQuotes
881 $barf = bar() if $foo; #Now exempt ControlStructures::ProhibitPostfixControls
882 $long_int = 10000000000; #Still subjected to ValuesAndExpression::RequireNumberSeparators
883
1bef6e21
JRT
884Since the Policy names are matched against the arguments as regular
885expressions, you can abbreviate the Policy names or disable an entire
886family of Policies in one shot like this:
c70a9ff6 887
c48094aa 888 ## no critic (NamingConventions)
c70a9ff6
JRT
889
890 my $camelHumpVar = 'foo'; #Now exempt from NamingConventions::ProhibitMixedCaseVars
891 sub camelHumpSub {} #Now exempt from NamingConventions::ProhibitMixedCaseSubs
892
c48094aa
JRT
893The argument list must be enclosed in parens and must contain one or
894more comma-separated barewords (e.g. don't use quotes). The <"## no
895critic"> pragmas can be nested, and Policies named by an inner pragma
896will be disabled along with those already disabled an outer pragma.
c70a9ff6 897
59b05e08 898Use this feature wisely. C<"## no critic"> should be used in the
1bef6e21
JRT
899smallest possible scope, or only on individual lines of code. And you
900should always be as specific as possible about which policies you want
901to disable (i.e. never use a bare C<"## no critic">). If Perl::Critic
902complains about your code, try and find a compliant solution before
903resorting to this feature.
59b05e08 904
21f4a0d3
JRT
905=head1 IMPORTANT CHANGES
906
907Perl-Critic is evolving rapidly. As such, some of the interfaces have
1bef6e21
JRT
908changed in ways that are not backward-compatible. If you have been
909using an older version of Perl-Critic and/or you have been developing
910custom Policy modules, please read this section carefully.
21f4a0d3 911
1bef6e21 912=head2 VERSION 0.16
21f4a0d3 913
1bef6e21
JRT
914Starting in version 0.16, you can add a list Policy names as arguments
915to the C<"## no critic"> pseudo-pragma. This feature allows you to
c0137eab
JRT
916disable specific policies. So if you have been in the habit of adding
917additional words after C<"no critic">, then those words might cause
918unexpected results. If you want to append other stuff to the C<"## no
919critic"> comment, then terminate the pseudo-pragma with a semi-colon,
920and then start another comment. For example:
1bef6e21
JRT
921
922 #This may not work as expected.
923 $email = 'foo@bar.com'; ## no critic for literal '@'
924
925 #This will work.
926 $email = 'foo@bar.com'; ## no critic; #for literal '@'
927
928 #This is even better.
c0137eab 929 $email = 'foo@bar.com'; ## no critic (RequireInterpolation);
21f4a0d3
JRT
930
931=head2 VERSION 0.14
932
933Starting in version 0.14, the interface to L<Perl::Critic::Violation>
934changed. This will also break any custom Policy modules that you
821d0eb5 935might have written for earlier modules. See L<DEVELOPER.pod> for an
21f4a0d3
JRT
936up-to-date guide on creating Policy modules.
937
938The notion of "priority" was also replaced with "severity" in version
195f8436 9390.14. Consequently, the default behavior of Perl::Critic is to only
21f4a0d3
JRT
940load the most "severe" Policy modules, rather than loading all of
941them. This decision was based on user-feedback suggesting that
942Perl-Critic should be less "critical" for new users, and should steer
943them toward gradually increasing the strictness as they adopt better
944coding practices.
945
1bef6e21
JRT
946
947=head2 VERSION 0.11
948
949Starting in version 0.11, the internal mechanics of Perl-Critic were
950rewritten so that only one traversal of the PPI document tree is
951required. Unfortunately, this will break any custom Policy modules
952that you might have written for earlier versions. Converting your
953policies to work with the new version is pretty easy and actually
954results in cleaner code. See L<DEVELOPER.pod> for an up-to-date guide
955on creating Policy modules.
956
b87b00dd
JRT
957=head1 THE L<Perl::Critic> PHILOSOPHY
958
959 Coding standards are deeply personal and highly subjective. The
1bef6e21
JRT
960 goal of Perl::Critic is to help you write code that conforms with a
961 set of best practices. Our primary goal is not to dictate what
b87b00dd 962 those practices are, but rather, to implement the practices
0c8fc9e4 963 discovered by others. Ultimately, you make the rules --
1bef6e21
JRT
964 Perl::Critic is merely a tool for encouraging consistency. If there
965 is a policy that you think is important or that we have overlooked,
966 we would be very grateful for contributions, or you can simply load
967 your own private set of policies into Perl::Critic.
b87b00dd 968
59b05e08
JRT
969=head1 EXTENDING THE CRITIC
970
971The modular design of Perl::Critic is intended to facilitate the
1e7b8681
JRT
972addition of new Policies. You'll need to have some understanding of
973L<PPI>, but most Policy modules are pretty straightforward and only
5ab86a86
JRT
974require about 20 lines of code. Please see the
975L<Perl::Critic::DEVELOPER> file included in this distribution for a
976step-by-step demonstration of how to create new Policy modules.
59b05e08
JRT
977
978If you develop any new Policy modules, feel free to send them to
979<thaljef@cpan.org> and I'll be happy to put them into the Perl::Critic
d66028df
JRT
980distribution. Or if you'd like to work on the Perl::Critic project
981directly, check out our repository at L<http://perlcritic.tigris.org>.
4d19da19
JRT
982To subscribe to our mailing list, send a message to
983C<dev-subscribe@perlcritic.tigris.org>.
59b05e08 984
59b05e08
JRT
985=head1 PREREQUISITES
986
987Perl::Critic requires the following modules:
988
59b05e08
JRT
989L<Config::Tiny>
990
991L<File::Spec>
992
1e7b8681
JRT
993L<IO::String>
994
59b05e08
JRT
995L<List::Util>
996
997L<List::MoreUtils>
998
1e7b8681
JRT
999L<Module::Pluggable>
1000
1001L<PPI>
1002
59b05e08
JRT
1003L<Pod::Usage>
1004
1005L<Pod::PlainText>
1006
4e771b0b
JRT
1007L<Scalar::Util>
1008
59b05e08
JRT
1009L<String::Format>
1010
1011The following modules are optional, but recommended for complete
1012testing:
1013
1014L<Test::Pod>
1015
1016L<Test::Pod::Coverage>
1017
1018L<Test::Perl::Critic>
1019
1020=head1 BUGS
1021
1022Scrutinizing Perl code is hard for humans, let alone machines. If you
1023find any bugs, particularly false-positives or false-negatives from a
1bef6e21 1024Perl::Critic::Policy, please submit them to
59b05e08
JRT
1025L<http://rt.cpan.org/NoAuth/Bugs.html?Dist=Perl-Critic>. Thanks.
1026
1027=head1 CREDITS
1028
b87b00dd 1029Adam Kennedy - For creating L<PPI>, the heart and soul of L<Perl::Critic>.
59b05e08 1030
b87b00dd 1031Damian Conway - For writing B<Perl Best Practices>, finally :)
59b05e08 1032
b87b00dd 1033Chris Dolan - For contributing the best features and Policy modules.
59b05e08 1034
b87b00dd 1035Giuseppe Maxia - For all the great ideas and positive encouragement.
59b05e08 1036
b87b00dd 1037and Sharon, my wife - For putting up with my all-night code sessions.
59b05e08
JRT
1038
1039=head1 AUTHOR
1040
1041Jeffrey Ryan Thalhammer <thaljef@cpan.org>
1042
1043=head1 COPYRIGHT
1044
c3c88e54 1045Copyright (c) 2005-2006 Jeffrey Ryan Thalhammer. All rights reserved.
59b05e08
JRT
1046
1047This program is free software; you can redistribute it and/or modify
1048it under the same terms as Perl itself. The full text of this license
1049can be found in the LICENSE file included with this module.
1050
1051=cut