Perl::...sSwitch(3pm)
β¨ NAME β¨
bestie, this is Perl::Critic::Policy::Community::WarningsSwitch from the User Contributed Perl Documentation (yeah the page header just calls it Perl::...sSwitch(3pm), we don't question the truncation π
). It's the policy that says: scripts should NOT use the -w switch on the shebang line. periodt.
π DESCRIPTION π
okay so. the -w switch turns warnings on globally in a perl program β and that includes every single module, even the ones that never asked for warnings either way. like, imagine turning the lights on in the whole house when you only wanted your own room lit. π β¨
and the -W switch? even messier. it turns warnings on even for modules that explicitly disabled them. the audacity.
the real problem here is that you're enabling warnings for code you did not write. some of those modules might not be designed to run with warnings enabled β but like, they still work fine. no cap. so the move is: just use warnings inside your own code only. your code, your warnings, your vibes. π
#!/usr/bin/perl -w # not ok
#!/usr/bin/perl -W # not ok
use warnings; # ok
ngl those first two lines are giving not ok energy and the third one ate. choose wisely bestie π
πΈ AFFILIATION πΈ
this policy is part of Perl::Critic::Community. it's got a whole family, iykyk. π«Ά
βοΈ CONFIGURATION βοΈ
this policy is not configurable except for the standard options. that's it. that's the whole tea. no extra knobs, no sliders, no nothing. π
π AUTHOR π
Dan Book, dbook@cpan.org β iconic behavior, we stan. π
π COPYRIGHT AND LICENSE π
Copyright 2015, Dan Book.
This library is free software; you may redistribute it and/or modify it under the terms of the Artistic License version 2.0.
π SEE ALSO π
Perl::Criticwarnings
perl v5.40.1 π¦ 2025-03-22 β and that's the whole page bestie, Perl::...sSwitch(3pm) signed, sealed, delivered π mwah, go use warnings; and be free β¨π
π¦ where this page comes from
- debian trixie: libperl-critic-community-perl 1.0.4-1 Β· Artistic-2.0
- ubuntu resolute: libperl-critic-community-perl 1.0.4-1 Β· Artistic-2.0
- ubuntu stonking: libperl-critic-community-perl 1.0.4-1 Β· Artistic-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms