The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Perl::Critic::Policy::Lax::RequireExplicitPackage::ExceptForPragmata - you can put strict and warnings before "package"

VERSION

version 0.014

DESCRIPTION

This policy is meant to replace Modules::RequireExplicitPackage. That policy's POD says:

  In general, the first statement of any Perl module or library should be a
  package statement.  Otherwise, all the code that comes before the package
  statement is getting executed in the caller's package, and you have no idea
  who that is.  Good encapsulation and common decency require your module to
  keep its innards to itself.

Sure, that's swell for code that has effect at a package level, but some statements are lexical. This policy makes allowance for some of those cases. By default, it permits turning on strictures, warnings, features, and diagnostics, as well as requiring a minimum Perl version.

PERL VERSION

This library should run on perls released even a long time ago. It should work on any version of perl released in the last five years.

Although it may work on older versions of perl, no guarantee is made that the minimum required version will not be increased. The version may be increased for any reason, and there is no promise that patches will be accepted to lower the minimum required perl.

METHODS

supported_parameters

The default list of pragmata that are permitted before a package declaration can be changed via the allowed_pragmata configuration parameter. Its value is a space-separated list of pragma names to be permitted. In this list, the name perlversion is special: it allows a use 5.xxx statement.

This module understands the exempt_scripts configuration parameter just like Perl::Critic::Policy::Modules::RequireExplicitPackage.

AUTHOR

Ricardo Signes <cpan@semiotic.systems>

COPYRIGHT AND LICENSE

This software is copyright (c) 2022 by Ricardo Signes <cpan@semiotic.systems>.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.