Perl::...::Pulp(3pm)
π NAME π
Perl::Critic::Pulp β a whole lil collection of add-on perlcritic policies β¨ (it's giving "extra rules, but make it Pulp" π)
πΈ DESCRIPTION πΈ
okay bestie, so this is a grab-bag of add-on policies for Perl::Critic. They hang out under a pulp theme, plus a bunch of other themes grouped by what they're actually for β peep POLICY THEMES in Perl::Critic for the receipts π«Ά
π Bugs π
CodeLayout::ProhibitFatCommaNewlineβ don't let a newline sneak in before=>when you're not quoting, bestie πCodeLayout::ProhibitIfIfSameLineβ watch out for} if () {, because you probably meantelsifMiscellanea::TextDomainPlaceholdersβ checks the keyword arguments you hand to__x(),__nx()and friendsModules::ProhibitUseQuotedVersionβ do not quote a version requirement likeuse Foo '1.5'ValuesAndExpressions::RequireNumericVersionβ keep$VERSIONas a plain number so comparisons and checking actually workValuesAndExpressions::ConstantBeforeLtβ dodges the whole disaster ofFOO < 123ValuesAndExpressions::NotWithCompareβ dodges the disaster of! $x == $yValuesAndExpressions::ProhibitArrayAssignArefβ flags those dubious@array=[1,2,3]array/arrayref assignments πValuesAndExpressions::ProhibitDuplicateHashKeysβ catches duplicate literal keys like%h = (xyz=>123, xyz=>456)ValuesAndExpressions::ProhibitFiletest_fβ just don't use-f, periodtValuesAndExpressions::UnexpandedSpecialLiteralβ for when special words like__PACKAGE__aren't expanding the way you think
π§© Compatibility π§©
Compatibility::ConstantPragmaHashβ the version requirement for hash-style multi-constantsCompatibility::ConstantLeadingUnderscoreβ the version requirement for constants with a leading underscoreCompatibility::Gtk2Constantsβ the Gtk2 module version requirement for certain constantsCompatibility::PerlMinimumVersionAndWhyβ the Perl version you declared, checked against the features you actually usedCompatibility::PodMinimumVersionβ the Perl version you declared, checked against the POD features you actually usedCompatibility::ProhibitUnixDevNullβ preferFile::Spec->devnullinstead of/dev/nullπ
β‘ Efficiency β‘
Documentation::RequireEndBeforeLastPodβ put__END__before the POD at the end of the fileMiscellanea::TextDomainUnusedβ calls outLocale::TextDomainbeing imported but never usedModules::ProhibitPOSIXimportβ don't import the whole entirePOSIX, bestie, it's so much
π Cosmetic π
CodeLayout::RequireTrailingCommaAtNewlineβ want that,comma at the end of a list when you're at a newlineCodeLayout::RequireFinalSemicolonβ wants that;semicolon on the last statement of a subroutine or blockValuesAndExpressions::ProhibitEmptyCommasβ catches stray consecutive commas,,ValuesAndExpressions::ProhibitNullStatementsβ catches stray semicolons;ValuesAndExpressions::ProhibitUnknownBackslashβ flags unknown escapes like\zin stringsValuesAndExpressions::ProhibitBarewordDoubleColonβ no double-colon barewords likeFoo::Bar::Modules::ProhibitModuleShebangβ no#!interpreter line in.pmfiles
π Documentation π
Documentation::ProhibitUnbalancedParensβ unbalanced or mismatched( )parens, brackets and bracesDocumentation::ProhibitAdjacentLinksβ put commas or some text between adjacentL<>linksDocumentation::ProhibitDuplicateHeadingsβ don't duplicate=headheadingsDocumentation::ProhibitDuplicateSeeAlsoβ don't duplicateL<>links in SEE ALSO sectionsDocumentation::ProhibitBadAproposMarkupβ avoidC<>in the NAME section, it's bad for man'saproposoutputDocumentation::RequireFilenameMarkupβ mark up/foofilenames, slayDocumentation::ProhibitLinkToSelfβ don'tL<>link to the document itself, it's giving main character energy in the worst wayDocumentation::ProhibitParagraphEndCommaβ don't end a paragraph with a,commaDocumentation::ProhibitParagraphTwoDotsβ don't end a paragraph with..(that's a stray extra dot)Documentation::ProhibitVerbatimMarkupβ verbatim paragraphs don't expandC<>etc markupDocumentation::RequireFinalCutβ have a=cutat the end of the fileDocumentation::RequireLinkedURLsβ useL<>markup on URLs
π― Selecting π―
You can literally always enable or disable whatever policies you do or don't want (check CONFIGURATION in Perl::Critic). And you may have already clocked that there's a huge range of builtin and add-on perlcritic policies β everything from straight-up buggy practice to deliberately restrictive or frankly quite bizarre. You are not meant to pass everything. Some policies might even be mutually contradictory, no cap π
The restrictive policies are meant as building blocks for a house style. Like ProhibitBarewordDoubleColon here, or something like ProhibitUnlessBlocks. They're usually a matter of personal preference, and non de gustibus disputandum as they say in the classics. Trying to follow all such policies would give away big parts of the language and quite likely land you with very un-typical code, fr fr.
Some of the restrictive policies are geared towards beginners. ProhibitUnknownBackslash here or RequireInitializationForLocalVars are along those lines. There might for instance be good backslashing which the prohibition doesn't recognise, or local variable initializers make no sense for output variables like $!, once you get to the level of knowing to use local to preserve such globals.
In general the POD of each policy is supposed to explain the motivation so you can see whether you want it or not. So if you're not turning off or drastically customizing at least half of all policies then you're either not trying or you're much too easily lead! π
π OTHER NOTES π
In most of the perlcritic documentation, including the Pulp add-ons here, policy names appear without the full Perl::Critic::Policy::... class part. In Emacs try man-completion.el to make M-x man automatically expand a suffix part at point, or ffap-perl-module.el for the same to go to the source.
- <http://user42.tuxfamily.org/man-completion/index.html>
- <http://user42.tuxfamily.org/ffap-perl-module/index.html>
In perlcritic's output you can ask for %P to see the full policy package name, so you can run perldoc or copy or follow etc. Here's a good output format you can drop in your .perlcriticrc. The file:line:column: part is a style Emacs will recognise.
verbose=%f:%l:%c:\n %P\n %m\n
See Perl::Critic::Violation for all available % escapes. perlcritic.el, which comes with perlcritic, has regexp patterns for Emacs to recognise the builtin perlcritic formats, but it's easier to output file:line:column: in the first place.
π SEE ALSO π
Perl::Critic
π HOME PAGE π
<http://user42.tuxfamily.org/perl-critic-pulp/index.html>
π COPYRIGHT π
Copyright 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2021 Kevin Ryde
Perl-Critic-Pulp is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version.
Perl-Critic-Pulp is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with Perl-Critic-Pulp. If not, see <http://www.gnu.org/licenses/>.
ok that's the whole thing bestie, ily, now go run perlcritic and let it read you for filth π
this was perl v5.40.1, dated 2025-10-21 β User Contributed Perl Documentation, and yeah we ate π½οΈβ¨
π¦ where this page comes from
- ubuntu resolute: libperl-critic-pulp-perl 100-1 Β· GPL-3.0-or-later
- ubuntu stonking: libperl-critic-pulp-perl 100-1 Β· GPL-3.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms