Perl::C...ragmata(3)

πŸ“¦
version 0.014 Β· 3 versions
, in epel 10

πŸ’… Perl::C...ragmata(3) β€” like, the whole manual name is Perl::Critic::Policy::Lax::RequireExplicitPackage::ExceptForPragmata, bestie, the header just got tired and cut it off πŸŽ€

okay so this is a Perl::Critic policy page, and it's genuinely so useful, stay with me ✨


🌸 NAME 🌸

Perl::Critic::Policy::Lax::RequireExplicitPackage::ExceptForPragmata β€” literally the policy that lets you put strict and warnings before package, which, yeah, we've all wanted πŸ’–


πŸ¦‹ VERSION πŸ¦‹

version 0.014 β€” that's the one, no cap


✨ DESCRIPTION ✨

So this policy exists to replace Modules::RequireExplicitPackage πŸ‘‘ and lowkey, the tea is that the old policy's POD says, and I'm quoting it exactly:

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 bestie, some statements are lexical β€” not me pointing that out β€” and 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. iconic behavior, honestly 🌈


πŸ’œ 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. so don't come for her, she's doing her best ��


🧚 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 β€” just names, space-separated, that's the vibe check ✨

And in this list, the name perlversion is special πŸ‘‘ it allows a use 5.xxx statement. iykyk πŸ’«

πŸ’Œ psst: this module understands the exempt_scripts configuration parameter just like Perl::Critic::Policy::Modules::RequireExplicitPackage does. same energy, different policy 🫢

πŸŽ€ AUTHOR πŸŽ€

Ricardo Signes <cpan@semiotic.systems> β€” thank you legend, we stan 🌟


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. periodt πŸ’…


okay that's the whole page and ngl you ate that reading, bestie πŸ“ this was perl v5.40.0, dated 2023-01-01, and the page is officially called Perl::C...ragmata(3) because even manpage headers need a little nap sometimes πŸ˜­πŸ’€ sleep well, see you in the next perldoc πŸ§šβ€β™€οΈπŸ’œ

πŸ“¦ where this page comes from