Perl::...Classes(3pm)
π NAME π
Okay so bestie, welcome to the Perl::...Classes(3pm) manual page β yep, User Contributed Perl Documentation energy β for Perl::Critic::Policy::RegularExpressions::ProhibitEnumeratedClasses. The whole vibe: use named character classes instead of explicit character lists. Periodt. π
π¦ AFFILIATION π¦
This Policy is part of the core Perl::Critic distribution. Iconic. β¨
β¨ DESCRIPTION β¨
π¨ Real talk: this policy is not for everyone! If you are working in pure ASCII, then disable it now or you may see some false violations. No cap.
On the other hand, many of us are working in a multilingual world with an extended character set, probably Unicode. In that world, patterns like m/[A-Z]/ can be a source of bugs when you really meant m/\p{IsUpper}/. This policy catches a selection of possible incorrect character class usage. Itβs giving safety net. π¦
Specifically, the patterns are:
"[\t\r\n\f\ ]"vs."\s""[\t\r\n\ ]"vs."\s"β because many people forget"\f""[A-Za-z0-9_]"vs."\w""[A-Za-z]"vs."\p{IsAlphabetic}""[A-Z]"vs."\p{IsUpper}""[a-z]"vs."\p{IsLower}""[0-9]"vs."\d""[^\w]"vs."\W""[^\s]"vs."\S"
π CONFIGURATION π
This Policy is not configurable except for the standard options. No extra knobs, bestie β just the standard options. π
πΈ CREDITS πΈ
Initial development of this policy was supported by a grant from the Perl Foundation. Slay. π
π AUTHOR π
Chris Dolan <cdolan@cpan.org>
π COPYRIGHT π
Copyright (c) 2007-2023 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 thatβs the whole page, bestie π«Ά signing off from Perl::...Classes(3pm) β perl v5.42.0, 2024-10-23 β stay iconic and may your regexes be named correctly β¨π
π¦ where this page comes from
- opensuse-leap 16.0: perl-Perl-Critic 1.156.0-bp160.1.1 Β· Artistic-1.0 OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms