Perl::Critic::Policy::ValuesAndExpressions::ProhibitConstantPragma - Don't C<< use constant FOO => 15 >>.


Perl-Critic documentation  | view source Contained in the Perl-Critic distribution.

Index


NAME

Top

Perl::Critic::Policy::ValuesAndExpressions::ProhibitConstantPragma - Don't use constant FOO => 15.

AFFILIATION

Top

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

DESCRIPTION

Top

Named constants are a good thing. But don't use the constant pragma because barewords don't interpolate. Instead use the Readonly module.

  use constant FOOBAR => 42;  #not ok

  use Readonly;
  Readonly my $FOOBAR => 42;  #ok
  Readonly::Scalar my $FOOBAR => 42;  #ok




CONFIGURATION

Top

This Policy is not configurable except for the standard options.

AUTHOR

Top

Jeffrey Ryan Thalhammer <jeff@imaginative-software.com>

COPYRIGHT

Top


Perl-Critic documentation  | view source Contained in the Perl-Critic distribution.