Perl::...arnings(3pm)

πŸ“¦
version 1.0.4 Β· 4 versions
, in debian trixie, ubuntu resolute, ubuntu stonking

✨ 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:

  1. explicitly imported with use
  2. indirectly through a whole bunch of importer modules β€” like Moose or strictures, 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 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