Perl's warnings pragma is the cheapest way to find bugs. We already use the strict pragma; now it's time to add warnings. More importantly, it's time to review the messages produced by the warnings pragma and fix the underlying issues.
To reiterate, this RFC has two goals: turning on warnings, and fixing all warnings thus reported. Doing the first without the second will simply cause Apache logs to overflow.
Ideally, all Perl scripts and modules should have warnings enabled by the time 3.2 is released.
I propose the following steps to implement this:
Update the coding guidelines to require 'use strict' and 'use warnings'.
For any new scripts and modules, require 'use warnings'. Since Koha (per Makefile.PL) requires at least
Perl 5.6.1, the 'use warnings' pragma should be used instead of -w.
Systematically go through and turn on warnings for each script and module.
Unsystematically turn on warnings. I.e., whenever you patch a particular script, consider following up with a separate patch to turn on warnings. I suggest a separate patch because turning on warnings is not enough; you should run the script through its paces and fix any problems reported by the warnings pragma. For modules in C4, note that this can be a big commitment: turning on warnings means testing every function and method.
Create a standing blocker bug for 3.2 for adding “use warnings”.
“no warnings” should not be used absent a detailed comment explaining why warnings should be turned off within a block and why it is not possible to change the code to avoid the warning. It might be acceptable for temporary use while turning on warnings in a big module