1Perl::Critic::Theme(3)User Contributed Perl DocumentationPerl::Critic::Theme(3)
2
3
4
6 Perl::Critic::Theme - Construct thematic sets of policies.
7
9 This is a helper class for evaluating theme expressions into sets of
10 Policy objects. There are no user-serviceable parts here.
11
13 This is considered to be a non-public class. Its interface is subject
14 to change without notice.
15
17 "new( -rule => $rule_expression )"
18 Returns a reference to a new Perl::Critic::Theme object. "-rule"
19 is a string expression that evaluates to true or false for each
20 Policy.. See "THEME RULES" for more information.
21
22 "policy_is_thematic( -policy => $policy )"
23 Given a reference to a Perl::Critic::Policy object, this method
24 returns evaluates the rule against the themes that are associated
25 with the Policy. Returns 1 if the Policy satisfies the rule, 0
26 otherwise.
27
28 rule()
29 Returns the rule expression that was used to construct this Theme.
30 The rule may have been translated into a normalized expression.
31 See "THEME RULES" for more information.
32
33 THEME RULES
34 A theme rule is a simple boolean expression, where the operands are the
35 names of any of the themes associated with the Perl::Critic::Polices.
36
37 Theme names can be combined with logical operators to form arbitrarily
38 complex expressions. Precedence is the same as normal mathematics, but
39 you can use parentheses to enforce precedence as well. Supported
40 operators are:
41
42 Operator Altertative Example
43 ----------------------------------------------------------------
44 && and 'pbp && core'
45 || or 'pbp || (bugs && security)'
46 ! not 'pbp && ! (portability || complexity)
47
48 See "CONFIGURATION" in Perl::Critic for more information about
49 customizing the themes for each Policy.
50
52 cook_rule( $rule )
53 Standardize a rule into almost executable Perl code. The "almost"
54 comes from the fact that theme names are left as is.
55
57 $RULE_INVALID_CHARACTER_REGEX
58 A regular expression that will return the first character in the
59 matched expression that is not valid in a rule.
60
62 Jeffrey Ryan Thalhammer <jeff@imaginative-software.com>
63
65 Copyright (c) 2006-2023 Imaginative Software Systems
66
67 This program is free software; you can redistribute it and/or modify it
68 under the same terms as Perl itself. The full text of this license can
69 be found in the LICENSE file included with this module.
70
71
72
73perl v5.36.0 2023-03-05 Perl::Critic::Theme(3)