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::Community::WarningsSwitch - Scripts should not use the -w switch on the shebang

Affiliation

       This policy is part of Perl::Critic::Community.

Author

       Dan Book, "dbook@cpan.org"

Configuration

       This policy is not configurable except for the standard options.

Description

       The "-w" switch enables warnings globally in a perl program, including for any modules that did not
       explicitly enable or disable any warnings. The "-W" switch enables warnings even for modules that
       explicitly disabled them. The primary issue with this is enabling warnings for code that you did not
       write.  Some of these modules may not be designed to run with warnings enabled, but still work fine.
       Instead, use warnings within your own code only.

         #!/usr/bin/perl -w # not ok
         #!/usr/bin/perl -W # not ok
         use warnings;      # ok

Name

       Perl::Critic::Policy::Community::WarningsSwitch - Scripts should not use the -w switch on the shebang
       line

See Also

       Perl::Critic, warnings

perl v5.40.1                                       2025-03-22              Perl::Critic::...:WarningsSwitch(3pm)

See Also