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
7

DESCRIPTION

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

NOTES

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

SEE ALSO

32       Perl::Critic::Policy::Variables::ProhibitPunctuationVars
33

AUTHOR

35       Jeffrey Ryan Thalhammer <thaljef@cpan.org>
36
38       Copyright (c) 2005-2007 Jeffrey Ryan Thalhammer.  All rights reserved.
39
40       This program is free software; you can redistribute it and/or modify it
41       under the same terms as Perl itself.  The full text of this license can
42       be found in the LICENSE file included with this module.
43
44
45
46perl v5.8.8              Perl::Cri2t0i0c7:-:0P3o-l2i0cy::Variables::ProhibitLocalVars(3)
Impressum