Im getting "Code before warnings are enabled" from Perl::Critic, even though I have -w
specified in the shebang
#!/usr/bin/perl -w
I really don't want to go through and replace all instances. Is there anything I can do? Additionally, I do want Perl::Critic
to ensure all Perl has warnings enabled.
You say perlcritic
doesn't do what you want, but that you want it to do what you want. As such, you will need modify perlcritic
, or more specifically, Perl:: Critic:: Policy:: TestingAndDebugging:: RequireUseWarnings. You should have no problems getting your changes accepted because the lack of shebang parsing is listed as a bug in the documentation.
It might be simpler to edit your files. It's quite trivial to do so mechanically. Assuming you already use use strict;
,
find -type f \( -name '*.pl' -o -name '*.pm' \) ! -name '*~' -exec \
perl -i~ -0777pe's/^(\s*)use strict\b.*\n\K/${1}use warnings;\n/mg' {} +