The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Perl::Review::Policy::Variables::ProhibitPackageVars

DESCRIPTION

Package variables are globally visible, thus exposing your implementation to prying eyes. 'Tis better to use accessor methods or static subs to change the state of things in your package.

This policy assumes that you're using strict vars so that variables declarations are not package variables by default. Thus, it complains you declare a variable with our or use vars, or if you make reference to variable with a fully-qualified package name.

  $Some::Package::foo = 1;    #not ok
  our $foo            = 1;    #not ok
  use vars '$foo';            #not ok
  $foo = 1;                   #not allowed by 'strict'
  my $foo = 1;                #ok

SEE ALSO

Perl::Review::Policy::Variables::ProhibitPunctuationVars

Perl::Review::Policy::Variables::ProhibitLocalVars

AUTHOR

Jeffrey Ryan Thalhammer <thaljef@cpan.org>

Copyright (c) 2005 Jeffrey Ryan Thalhammer. All rights reserved.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. The full text of this license can be found in the LICENSE file included with this module.