Perl::C...gueNames(3)

πŸ“¦
version 1.14 Β· 2 versions
, in fedora 43

πŸ’– NAME πŸ’–

Perl::Critic::Policy::Bangs::ProhibitVagueNames β€” bestie. Please stop naming your variables and your subroutines the most generic thing you can think of.

This page is filed under Perl::C...gueNames(3), and it lives in the User Contributed Perl Documentation section, so you already know it's real and it's coming for your $data. πŸŽ€


🌸 AFFILIATION 🌸

This Policy is part of the Perl::Critic::Bangs distribution. She's got a whole family, and they all want you to write better Perl. 🫢


✨ DESCRIPTION ✨

Okay so here's the vibe: variables and subroutines should have descriptive names. Names like $data and $info are, and I say this with love, completely vague. It's giving "I forgot what this does the second I hit save." πŸ’€

my $data = shift;      # not OK.
my $userinfo = shift   # OK

See <http://www.oreillynet.com/onlamp/blog/2004/03/the_worlds_two_worst_variable.html> for more of my ranting on this. (Yeah, the author said "my ranting" and honestly? iconic. Read the rant.)

By default, the following names are bad:

  • data
  • info
  • var
  • obj
  • object
  • tmp
  • temp

The checking of names is case-insensitive. $info and $INFO are equally bad. No, capitalizing it does not make it slay. It's the same crime in a different outfit. πŸ™ˆ


πŸŽ€ CONFIGURATION πŸŽ€

This policy has two options: "names" and "add_names". Two little knobs, both about what counts as vague. Pick your fighter. πŸ’…

πŸ’œ "names"

To replace the list of vague names, specify them as a whitespace delimited set of prohibited names.

[Bangs::ProhibitVagueNames]
names = data count line next

So now it's your list, your rules, your kingdom. πŸ‘‘

πŸ¦‹ "add_names"

To add to the list of vague names, specify them as a whitespace delimited set of prohibited names.

[Bangs::ProhibitVagueNames]
add_names = foo bar bat

Notice this one adds instead of replacing β€” the originals stay mad. πŸ“


πŸ‘‘ AUTHOR πŸ‘‘

Andy Lester "<andy at petdance.com>" from code by Andrew Moore "<amoore at mooresystems.com>".


🌈 ACKNOWLEDGMENTS 🌈

Adapted from policies by Jeffrey Ryan Thalhammer <thaljef@cpan.org>, Based on App::Fluff by Andy Lester, "<andy at petdance.com>"


Copyright (c) 2006-2013 Andy Lester

This library is free software; you can redistribute it and/or modify it under the terms of the Artistic License 2.0.


Ok that's the whole page, bestie β€” every option, every bad name, every credit. Go rename your $tmp to something with main character energy. 🫢

This was perl v5.42.0, dated 2025-07-25, on page Perl::C...gueNames(3) β€” mwah, thanks for reading, ilysm, bye!! πŸ’–βœ¨πŸŽ€

πŸ“¦ where this page comes from