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 (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