Perl::...Version(3pm)
β¨ NAME β¨
Perl::Critic::Policy::Modules::RequirePerlVersion β bestie, this policy wants you to put a use 5.006; (or something like it) at the top of your file. That's it, that's the whole job. π
So real quick, before we go any further: this page is Perl::...Version(3pm) from the User Contributed Perl Documentation β yeah the name got truncated all cute like that, but it's your girl, she's here, she's ready. πΈ
π«Ά AFFILIATION π«Ά
This policy lives inside Perl::Critic::More, which is the bleeding edge supplement to Perl::Critic. So it's the extra-spicy bonus pack, not the base game. π₯
π DESCRIPTION π
Okay so here's the tea: as Perl evolves, new β¨desirable featuresβ¨ keep getting added. Which is great! Obsessed. Exceptβ¦ the best ones have a nasty little habit of breaking backward compatibility. π Not their fault, they're just built different.
So as a favor to the downstream developers (the people who have to run your code, the ones who are NOT you, the ones who will absolutely be crying at 2am), it's genuinely good manners to say out loud and explicitly which Perl version will not be able to parse your code. Like, just tell them. Communicate. It's giving considerate. π
Example time, because examples slay:
The our keyword first appeared in a stable Perl in version 5.6.0. So if your code is out here using our, then you should have a line like this sitting near the very top of your file:
use 5.006;
or, alternatively:
use v5.6.0;
Now β the first one is preferred, because the second one can trigger v-string compatibility warnings. And honestly? If someone could please explain that to me, I'd really appreciate it! (Direct quote, we're all confused together, no cap.) π
Also, while we're being all thoughtful and mature: it's good form to state that minimum version in your Makefile.PL or Build.PL file too. Two places, one vibe. π
π AUTHOR π
Chris Dolan <cdolan@cpan.org>
π COPYRIGHT π
Copyright (c) 2006-2008 Chris Dolan
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 bestie that's the whole page, mwah π β this was perl v5.42.0, dated 2025-07-25, and you can find it hanging out under Perl::...Version(3pm). go forth and declare your minimum version, you icon. βπ¦
π¦ where this page comes from
- fedora 43: perl-Perl-Critic-More 1.003-33.fc43 Β· GPL-1.0-or-later OR Artistic-1.0-Perl
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms