Perl::...ations(3pm)
π NAME
Bestie, this is Perl::Critic::Policy::Variables::ProhibitConditionalDeclarations β and the whole vibe is literally just: do not write my $foo = $bar if $baz;. That's it. That's the policy. π«β¨
π«Ά AFFILIATION
This policy ships as part of the core Perl::Critic distribution β so it's already in the group chat, no invite needed. π
π DESCRIPTION
Okay so, declaring a variable with a postfix conditional? Deeply confusing. Genuinely it's giving chaos. If the conditional is false, it is not clear whether the variable will be false, undefined, undeclared, or what. Likeβ¦ pick a lane bestie π΅βπ«
It is much more straightforward to make your variable declarations separately. Keep them on their own little main-character moment. π
These are all not it:
my $foo = $baz if $bar; #not ok
my $foo = $baz unless $bar; #not ok
our $foo = $baz for @list; #not ok
local $foo = $baz foreach @list; #not ok
All four? Not ok. Not a single one. π
π CONFIGURATION
This policy is not configurable except for the standard options. That's it. No extra knobs, no secret settings menu, nothing to tweak. π¦
β¨ AUTHOR
Jeffrey R. Thalhammer <jeff@imaginative-software.com> β an icon, a legend, the moment. π«Ά
π COPYRIGHT
Copyright (c) 2006-2011 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. π
Fr fr, read your license, bestie. It's giving responsible adult energy and honestly? Slay. π
β¨ cute lil sign-off time β¨ β this page is from the perl v5.42.0 distribution, dated 2024-10-23, and it's the Perl::...ations(3pm) manual page brought to you by User Contributed Perl Documentation. 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