logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

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

Affiliation

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

Author

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

Configuration

       This Policy is not configurable except for the standard options.

Description

       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

Name

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

See Also