1Perl::Critic::Policy::VUasreirPaebCrlolen:st::rC:irPbirutotihecid:b:iPPteoLrloliccaDylo:Vc:auVrmaser(ni3ta)abtlieosn::ProhibitLocalVars(3)
2
3
4

NAME

6       Perl::Critic::Policy::Variables::ProhibitLocalVars - Use "my" instead
7       of "local", except when you have to.
8

AFFILIATION

10       This Policy is part of the core Perl::Critic distribution.
11

DESCRIPTION

13       Since Perl 5, there are very few reasons to declare "local" variables.
14       The most common exceptions are Perl's magical global variables.  If you
15       do need to modify one of those global variables, you should localize it
16       first.  You should also use the English module to give those variables
17       more meaningful names.
18
19           local $foo;   #not ok
20           my $foo;      #ok
21
22           use English qw(-no_match_vars);
23           local $INPUT_RECORD_SEPARATOR    #ok
24           local $RS                        #ok
25           local $/;                        #not ok
26

CONFIGURATION

28       This Policy is not configurable except for the standard options.
29

NOTES

31       If an external module uses package variables as its interface, then
32       using "local" is actually a pretty sensible thing to do.  So
33       Perl::Critic will not complain if you "local"-ize variables with a
34       fully qualified name such as $Some::Package::foo.  However, if you're
35       in a position to dictate the module's interface, I strongly suggest
36       using accessor methods instead.
37

SEE ALSO

39       Perl::Critic::Policy::Variables::ProhibitPunctuationVars
40

AUTHOR

42       Jeffrey Ryan Thalhammer <jeff@imaginative-software.com>
43
45       Copyright (c) 2005-2011 Imaginative Software Systems.  All rights
46       reserved.
47
48       This program is free software; you can redistribute it and/or modify it
49       under the same terms as Perl itself.  The full text of this license can
50       be found in the LICENSE file included with this module.
51
52
53
54perl v5.28.1             Perl::Cri2t0i1c9:-:0P2o-l0i2cy::Variables::ProhibitLocalVars(3)
Impressum