[Koha-devel] RFC 3.2 - turn on warnings

Galen Charlton galen.charlton at liblime.com
Tue Aug 5 19:07:59 CEST 2008


Hi,

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:

1. Update the coding guidelines to require 'use strict' and 'use warnings'.
2. 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.
3. Systematically go through and turn on warnings for each script and module.
4. 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.
5. Create a standing blocker bug for 3.2 for adding "use warnings".
6. "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

This RFC can also be found at

http://wiki.koha.org/doku.php?id=en:development:rfcs3.2:rfc32_turn_on_warnings

Regards,

Galen
-- 
Galen Charlton
VP, Research & Development, LibLime
galen.charlton at liblime.com
p: 1-888-564-2457 x709
skype: gmcharlt



More information about the Koha-devel mailing list