Perl::...::Theme(3pm)
π NAME π
okay so, bestie: this is the Perl::Critic::Theme page β the header calls it Perl::...::Theme(3pm) and it's from the User Contributed Perl Documentation. What does it do? Construct thematic sets of policies. That's the whole NAME section, periodt. π
β¨ DESCRIPTION β¨
This is a helper class for evaluating theme expressions into sets of Policy objects. There are literally no user-serviceable parts here β it's a helper, not a DIY project. π§
π INTERFACE SUPPORT π
π¨ This is considered to be a non-public class. Its interface is subject to change without notice. So if you're building a whole main-character app on it, know that it can shift under you β no cap. π
π§΅ METHODS π§΅
new( -rule => $rule_expression )β returns a reference to a freshPerl::Critic::Themeobject.-ruleis a string expression that evaluates to true or false for eachPolicy.. (yes, two dots, bestie π). SeeTHEME RULESfor the whole lore.policy_is_thematic( -policy => $policy )β hand it a reference to aPerl::Critic::Policyobject, and it evaluates the rule against the themes associated with that Policy. Returns1if the Policy satisfies the rule,0otherwise. Slay. πrule()β returns the rule expression that was used to construct this Theme. Heads up: the rule may have been translated into a normalized expression. SeeTHEME RULES.
π THEME RULES π
A theme rule is a simple boolean expression, where the operands are the names of any of the themes associated with the Perl::Critic::Polices (yes, that's Polices β the missing i is literally in the original, don't come for me π). Theme names can be combined with logical operators to form arbitrarily complex expressions. Precedence is the same as normal mathematics, but you can use parentheses to enforce precedence as well. Supported operators are:
Operator Altertative Example
----------------------------------------------------------------
&& and 'pbp && core'
|| or 'pbp || (bugs && security)'
! not 'pbp && ! (portability || complexity)
and yes, the table spells it Altertative, and that last example is missing its closing quote in the original β I'm preserving the chaos, not fixing it π.
See CONFIGURATION in Perl::Critic for more information about customizing the themes for each Policy. β¨
π SUBROUTINES π
cook_rule( $rule )β standardizes a rule into almost executable Perl code. The "almost" comes from the fact that theme names are left as is. Cute. π
π CONSTANTS π
$RULE_INVALID_CHARACTER_REGEXβ a regular expression that will return the first character in the matched expression that is not valid in a rule. Iconic little regex. π
π AUTHOR π
Jeffrey Ryan Thalhammer <jeff@imaginative-software.com> β the icon behind this page. π«Ά
π COPYRIGHT π
Copyright (c) 2006-2023 Imaginative Software Systems
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.
mwah π β this page is from perl v5.42.0, dated 2024-10-23, and the footer title is Perl::...::Theme(3pm). bye bestie, go theme some policies π«Άβ¨
π¦ 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