1Perl::Critic::Policy::VUasreirPaebCrlolen:st::rC:irPbirutotihecid:b:iPPteoLrloliccaDylo:Vc:auVrmaser(ni3ta)abtlieosn::ProhibitLocalVars(3)
2
3
4
6 Perl::Critic::Policy::Variables::ProhibitLocalVars - Use "my" instead
7 of "local", except when you have to.
8
10 This Policy is part of the core Perl::Critic distribution.
11
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
28 This Policy is not configurable except for the standard options.
29
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
39 Perl::Critic::Policy::Variables::ProhibitPunctuationVars
40
42 Jeffrey Ryan Thalhammer <thaljef@cpan.org>
43
45 Copyright (c) 2005-2009 Jeffrey Ryan Thalhammer. All rights reserved.
46
47 This program is free software; you can redistribute it and/or modify it
48 under the same terms as Perl itself. The full text of this license can
49 be found in the LICENSE file included with this module.
50
51
52
53perl v5.12.1 Perl::Cri2t0i1c0:-:0P9o-l0i8cy::Variables::ProhibitLocalVars(3)