lint
for Perlstrict.pm
which is a runtime live
code analyzerTest::Perl::Critic
by Jeffrey Ryan Thalhammer (THALJEF)
→ Use code to optimize for you!
% perlcritic PerfectCode.pm
# OK
% perlcritic LegacyCode.pm
Code before strictures are enabled at line 3, column 1. See page 429 of PBP. (Severity: 5)
Expression form of 'eval' at line 4, column 4. See page 161 of PBP. (Severity: 5)
Lenient (the default)
% perlcritic -5 Foo.pm
Typical
% perlcritic -3 Foo.pm
Pedantic
% perlcritic -1 Foo.pm
Examples:
Modules::RequireBarewordIncludes
ClassHierarchies::ProhibitExplicitISA
CodeLayout::ProhibitParensWithBuiltins
Create a ~/.perlcriticrc
file
[-CodeLayout::RequireTidyCode]
[-ControlStructures::ProhibitCStyleForLoops]
[-Documentation::RequirePodAtEnd]
[-Documentation::RequirePodSections]
[-Miscellanea::RequireRcsKeywords]
[-NamingConventions::ProhibitMixedCaseSubs]
[ControlStructures::ProhibitCascadingIfElse]
max_elsif = 3
Perl::Critic has flags to ignore special cases
## no critic
at the end of a line## no critic
... code ...
## use critic
$email = 'foo@bar.com'; ## no critic(RequireInterpolation)
sub _calc_xml_paths { ## no critic(ExcessComplexity)
... lots of code ...
}
And introducing P::C testing via the web: http://perlcritic.com