[Koha-devel] RFC 3.2 - turn on warnings

Chris Nighswonger chris.nighswonger at liblime.com
Wed Aug 6 00:03:26 CEST 2008


On Tue, Aug 5, 2008 at 1:07 PM, Galen Charlton
<galen.charlton at liblime.com> wrote:
> 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
>

Excellent idea! It will go a long way toward adding some syntactical
law and order to our code.

-- 
Chris Nighswonger

LibLime
www.liblime.com
chris.nighswonger at liblime.com



More information about the Koha-devel mailing list