Skip site navigation (1)Skip section navigation (2)

FreeBSD Manual Pages

  
 
  

home | help
Perl::Critic::Policy::UsereContributed:PerlcDocumenta:ProhibitNumberedNames(3)

NAME
       Perl::Critic::Policy::Bangs::ProhibitNumberedNames - Prohibit variables
       differentiated by trailing numbers.

AFFILIATION
       This Policy is part of the Perl::Critic::Bangs distribution.

DESCRIPTION
       Similar variables should	be meaningfully	different.  A lazy way to
       differentiate similar variables is by tacking a number at the end.

	   my $total = $price *	$quantity;
	   my $total2 =	$total + ($total * $taxrate);
	   my $total3 =	$total2	+ $shipping;

       The difference between $total and $total3 is not	described by the silly
       "3" at the end.	Instead, it should be:

	   my $merch_total = $price * $quantity;
	   my $subtotal	= $merch_total + ($merch_total * $taxrate);
	   my $grand_total = $subtotal + $shipping;

       See
       <http://www.oreillynet.com/onlamp/blog/2004/03/the_worlds_two_worst_variable.html>
       for more	of my ranting on this.

CONFIGURATION
       This policy has two options: "exceptions" and "add_exceptions".

   "exceptions"
       This policy starts with a list of numbered names	that are legitimate to
       have ending with	a number:

	   md5,	x11, utf8

       To replace the list of exceptions, specify a value for the "exceptions"
       option.

	   [Bangs::ProhibitNumberedNames]
	   exceptions =	logan7 babylon5

   "add_exceptions"
       To add exceptions to the	list, give a value for "add_exceptions"	in
       your .perlcriticrc file like this:

	   [Bangs::ProhibitVagueNames]
	   add_names = adam12 route66

AUTHOR
       Andy Lester "<andy at petdance.com>"

COPYRIGHT
       Copyright (c) 2006-2011 Andy Lester

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

perl v5.24.1		 Perl::Critic::Policy::Bangs::ProhibitNumberedNames(3)

NAME | AFFILIATION | DESCRIPTION | CONFIGURATION | AUTHOR | COPYRIGHT

Want to link to this manual page? Use this URL:
<https://www.freebsd.org/cgi/man.cgi?query=Perl::Critic::Policy::Bangs::ProhibitNumberedNames&sektion=3&manpath=FreeBSD+12.0-RELEASE+and+Ports>

home | help