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 fresh Perl::Critic::Theme object. -rule is a string expression that evaluates to true or false for each Policy.. (yes, two dots, bestie 😭). See THEME RULES for the whole lore.
  • policy_is_thematic( -policy => $policy ) β€” hand it a reference to a Perl::Critic::Policy object, and it evaluates the rule against the themes associated with that Policy. Returns 1 if the Policy satisfies the rule, 0 otherwise. 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. See THEME 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 (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