Perl::...arnings(3pm)
β¨ NAME β¨
Perl::Critic::Policy::Community::StrictWarnings β bestie, the whole entire point is: always use strict and warnings, or at least a module that imports them for you π
(also hey, this is one of the User Contributed Perl Documentation pages, so you know it's community-made with love π«Ά)
πΈ DESCRIPTION πΈ
okay so listen. the strict and warnings pragmas are literally your besties when it comes to dodging the classic pitfalls β think misspellings, scoping issues, and doing operations on undefined values. not the vibe. π
and warnings isn't just there to nag you, bestie β it can also alert you to deprecated or experimental functionality. it's giving protective older sibling energy fr fr.
so how do these pragmas get in? two ways, no cap:
- explicitly imported with
use - indirectly through a whole bunch of importer modules β like
Mooseorstrictures, iconic behavior honestly
and btw, lowkey freebies: strict is also enabled automatically with a use declaration of perl version 5.12 or higher, and warnings gets auto-enabled the same way with 5.36 or higher. the perl itself is doing the work for you. main character energy. π
here's the whole menu of valid ways to make this policy happy:
use strict;
use warnings;
use Moose;
use 5.012;
use warnings;
use 5.036;
This policy is similar to the core policies Perl::Critic::Policy::TestingAndDebugging::RequireUseStrict and Perl::Critic::Policy::TestingAndDebugging::RequireUseWarnings, but it combines them into one policy in the community theme. so like, two policies walked into a room and became one. slay. π
The default modules recognized as importing strict and warnings are defined by the same constants as the core policies β that's @STRICT_EQUIVALENT_MODULES in Perl::Critic::Utils::Constants. Wanna add your own modules to the list? See "CONFIGURATION" below, bestie, I got you. β¨
π¦ AFFILIATION π¦
This policy is part of Perl::Critic::Community. it's a whole community thing, iykyk. π«Ά
π CONFIGURATION π
You can configure this policy to recognize additional modules as importers of strict and warnings β just drop an entry in a .perlcriticrc file, like this:
[Community::StrictWarnings]
extra_importers = MyApp::Class MyApp::Role
that's it, that's the whole thing. customize away π
π AUTHOR π
Dan Book, dbook@cpan.org β thank you for your service, king π
β COPYRIGHT AND LICENSE β
Copyright 2015, Dan Book.
This library is free software; you may redistribute it and/or modify it under the terms of the Artistic License version 2.0.
π SEE ALSO π
- Perl::Critic
okay that's the whole page, bestie, you ate it π
β¨ this was perl v5.40.1, dated 2025-03-22, from the Perl::...arnings(3pm) page β mwah, go write some clean code, no cap ππ¦
π¦ where this page comes from
- debian trixie: libperl-critic-community-perl 1.0.4-1 Β· Artistic-2.0
- ubuntu resolute: libperl-critic-community-perl 1.0.4-1 Β· Artistic-2.0
- ubuntu stonking: libperl-critic-community-perl 1.0.4-1 Β· Artistic-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms