|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Check your CPAN modules for use vars
by haukex (Archbishop) on Jun 26, 2018 at 10:17 UTC | |
I think you are misunderstanding the perldelta entry. It says (emphasis mine): The usage of use vars has been discouraged since the introduction of our in Perl 5.6.0. Where possible the usage of this pragma has now been removed from the Perl source code. vars is still very much present, just its usage by the Perl core has been removed. Note that the change is not listed in the "Incompatible Changes" section, and "Updated Modules and Pragmata" actually says "vars has been upgraded from version 1.03 to 1.04." See also:
perl5/ $ git log --oneline --grep="use vars" v5.26.0..v5.28.0 | [reply] [d/l] [select] |
|
Re: Check your CPAN modules for use vars
by stevieb (Canon) on Jun 26, 2018 at 22:07 UTC | |
It's been already confirmed that you "misunderstood" the perldelta entry regarding use vars;, I just want to throw a piece of advice to you... It is advantageous to use variable names that are descriptive of the function they are being used for. It is very difficult to comprehend code that is full of variables that are single-letter, other than those that are pretty much iteration-type variables (or single-char vars that are used in an extremely small/tight context, but I'd still recommend against it). $c, $n, $f, $m, $g... even in your small few-line code script there, it becomes a bit overwhelming. Extra keystrokes matter when writing code, and they are especially important when reading code a couple of days, months or years later. At least in Perl, we don't have to define everything with a type, such as const char* thing (c) or nonsense like List<Thing> thing = new List<Thing>() (c#). We can just do my $thing. The my and the full name of the variable are very useful. | [reply] [d/l] [select] |
by hippo (Archbishop) on Jun 27, 2018 at 08:33 UTC | |
Completely agree. tchrist's Style Guide has this to say on the subject and includes this absolute gem from Dominus: The appropriate length of a name is directly proportional to the size of its scope. which, together with tchrist's philosophy that clarity trumps length (to which I also subscribe) I think sums it up nicely. It's also worth pointing out for completeness that such matters of style apply to any names in source: subs, packages, constants, variables, etc. It's fair to say that this advice is perfectly generic and applicable not just to Perl. | [reply] |
by usemodperl (Beadle) on Jun 27, 2018 at 11:23 UTC | |
STOP REINVENTING WHEELS, START BUILDING SPACE ROCKETS!—CPAN 🐪
| [reply] [d/l] |
|
Re: Check your CPAN modules for use vars
by Anonymous Monk on Jun 25, 2018 at 23:19 UTC | |
no it hasnt, stop spreading FUD | [reply] |
by usemodperl (Beadle) on Jun 25, 2018 at 23:51 UTC | |
STOP REINVENTING WHEELS, START BUILDING SPACE ROCKETS!—CPAN 🐪
| [reply] |
by Anonymous Monk on Jun 26, 2018 at 07:13 UTC | |
| [reply] |