Perl::...erators(3pm)
πΈ Perl::Critic::Policy::ValuesAndExpressions::ProhibitMixedBooleanOperators (3pm) πΈ
okay bestie, welcome to the User Contributed Perl Documentation page for Perl::Critic::Policy::ValuesAndExpressions::ProhibitMixedBooleanOperators β thatβs the manual name, and weβre in section 3pm, iykyk. π
β¨ NAME β¨
This policy is literally here to tell you: Write !$foo && $bar || $baz instead of not $foo && $bar or $baz. Thatβs the whole assignment. π
π«Ά AFFILIATION π«Ά
This Policy is part of the core Perl::Critic distribution. iconic, honestly. π
π¦ DESCRIPTION π¦
Conway advises against combining the low-precedence booleans (and or not) with the high-precedence boolean operators (&& || !) in the same expression. Unless you fully understand the differences between the high and low-precedence operators, it is easy to misinterpret expressions that use both. And even if you do understand them, it is not always clear if the author actually intended it. the way that is such a real trap π
Hereβs the vibe check:
next if not $foo || $bar; #not ok
next if !$foo || $bar; #ok
next if !( $foo || $bar ); #ok
slay β see how the ok ones keep it clean? π
π CONFIGURATION π
This Policy is not configurable except for the standard options. So no extra knobs, no secret settings β just the standard options, periodt. π
π AUTHOR π
Jeffrey Ryan Thalhammer <jeff@imaginative-software.com> β shoutout to the author, main character energy fr fr. π«Ά
π COPYRIGHT π
Copyright (c) 2005-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. π
xoxo, bestie π this pageβs source/version is perl v5.42.0, dated 2024-10-23 β mwah π«Ά
π¦ 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