Perl::Critic::Policy::Community::StrictWarnings(3pm)

Perl::Critic::Policy::Community::StrictWarnings3pm

Always use strict and warnings, or a module that imports these

Overview

The strict and warnings pragmas help avoid many common pitfalls such as misspellings, scoping issues, and performing operations on undefined values. Warnings can also alert you to deprecated or experimental functionality. The pragmas may either be explicitly imported with "use", or indirectly through a number of importer modules such as Moose or strictures. strict is also enabled automatically with a "use" declaration of perl version 5.12 or higher, as is warnings with a "use" declaration of 5.36 or higher.

  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 combines them into one policy in the "community" theme. The default modules recognized as importing strict and warnings are defined by the same constants as the core policies, "@STRICT_EQUIVALENT_MODULES" in Perl::Critic::Utils::Constants. To define additional modules, see "CONFIGURATION".

Affiliation

This policy is part of Perl::Critic::Community.

Configuration

This policy can be configured to recognize additional modules as importers of strict and warnings, by putting an entry in a ".perlcriticrc" file like this:

  [Community::StrictWarnings]
  extra_importers = MyApp::Class MyApp::Role

Releases

2 releases since Debian 12 (Bookworm); the text changed 1 time.

  1. 12
  2. 13

Author

Dan Book, "[email protected]"

From libperl-critic-community-perl 1.0.4-1 in Debian 13 (Trixie). Parsed by carta from the page's man source.