Perl::...iables(3pm)

🌸 NAME 🌸

okay bestie, welcome to the Perl::...iables(3pm) page in the User Contributed Perl Documentation β€” yes, that whole corner of the docs, periodt. The main character here is Perl::Critic::Policy::Variables::ProhibitUnusedVariables, and its whole motto is Don't ask for storage you don't need. πŸ’…

🫢 AFFILIATION 🫢

This Policy is part of the core Perl::Critic distribution β€” no cap. ✨

✨ DESCRIPTION ✨

Unused variables clutter code and require the reader to do mental bookkeeping to figure out if the variable is actually used or not. It's giving messy room energy, honestly 😭.

At present, this Policy is very limited in order to ensure that there aren't any false positives. Hopefully, this will become more sophisticated soon. 🧚

Right now, this only looks for simply declared, uninitialized lexical variables:

    my $x;          # not ok, assuming no other appearances.
    my @y = ();     # ok, not handled yet.
    our $z;         # ok, global.
    local $w;       # ok, global.
ngl, this module is very dumb: it does no scoping detection, i.e. if the same variable name is used in two different locations, even if they aren't the same variable, this Policy won't complain. Have to start somewhere. πŸ’€

πŸŽ€ CONFIGURATION πŸŽ€

No extra knobs or secret settings, bestie: this Policy is not configurable except for the standard options. That's the whole configuration section, fr fr. πŸŽ€

πŸ‘‘ AUTHOR πŸ‘‘

Elliot Shank "<perl@galumph.com>" β€” iconic. πŸ‘‘

Copyright (c) 2008-2021 Elliot Shank.

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. πŸ’œ


πŸ’– signed off by perl v5.42.0, dated 2024-10-23, and filed under Perl::...iables(3pm) β€” periodt. πŸŽ€

πŸ“¦ where this page comes from