Perl::...eStrict(3pm)
π NAME π
Okay bestie, so this page is from the User Contributed Perl Documentation, and the manual in question is Perl::...eStrict(3pm) β which is honestly just the glamorous stage name for Perl::Critic::Policy::TestingAndDebugging::RequireUseStrict. And what does it do? It's the policy for always use strict. Periodt. β¨
π AFFILIATION π
This Policy is part of the core Perl::Critic distribution. She's not a special guest, she lives here. π
πΈ DESCRIPTION πΈ
Using strictures is probably the single most effective way to improve the quality of your code β like, not to be dramatic but it's giving glow-up, it's giving skin care routine, it's giving actually working. π₯
This policy requires that the 'use strict' statement must come before any other statements except package, require, and other use statements. So yeah, she goes near the top, and then literally all the code in the entire package will be affected. Main character energy, no cap. π
There are special exemptions for Moose, Moose::Role, and Moose::Util::TypeConstraints because they enforces strictness β yes, that's the original's grammar, we don't gatekeep β e.g. 'use Moose' is treated as equivalent to 'use strict'. Bestie Moose is already doing the work, so we're not gonna double-charge her. π¦
The maximum number of violations per document for this policy defaults to 1. One (1) single callout. That's all you get. π
β¨ CONFIGURATION β¨
So if you make use of things like Moose::Exporter, you can create your own modules that import the strict pragma into the code that is "use"ing them. Cute, right? π
There is an option to add to the default set of pragmata and modules in your .perlcriticrc: "equivalent_modules". Like this, bestie:
[TestingAndDebugging::RequireUseStrict]
equivalent_modules = MooseX::My::Sugar
Slap that in and your own sugar modules get the same VIP treatment. π
π SEE ALSO π
Perl::Critic::Policy::TestingAndDebugging::ProhibitNoStrictβ the sibling policy, go say hi π
π«Ά AUTHOR π«Ά
Jeffrey Ryan Thalhammer <jeff@imaginative-software.com> β iconic, we stan, thank you for your service. π
π 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
Okay that's the whole page, go forth and use strict before anything else, mwah π
β signed, sealed, delivered by perl v5.42.0, dated 2024-10-23 β the footer said it, so I said it β
π¦ where this page comes from
- opensuse-leap 16.0: perl-Perl-Critic 1.156.0-bp160.1.1 Β· Artistic-1.0 OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms