[Koha-devel] Coding guidelines and Plack

Marcel de Rooy M.de.Rooy at rijksmuseum.nl
Wed Sep 25 17:04:19 CEST 2013


Thanks for this thorough response!



>> Should we add a PERL rule that prohibits defining lexical variables (my $var) at the outermost block (file level) ?

> -1 for scripts -- it's not necessary, and doing anything to tempt folks to use 'our' unnecessarily instead would be worse.  It's sufficient to ensure that any subroutines inside the file aren't inappropriately accessing file-level lexicals, and that's easy to test by verifying that the following doesn't emit any warning messages:
You are right. I actually meant the same :) Defining them and using these vars at a lower level.  Recently submitted some code that actually did that (just lazy programming and not passing these vars as parameters).. I would opt for adding such a explicit guideline.

> A provisional +1 for modules, where use of a package-level lexical is a signal that state may be held on to inappropriately.  Running the CGI::Compile test on *.pm files can point out the most egregious examples, though.
Another guideline here might make us more aware of doing so, or at least make author, signer or QAer perhaps think about it..
> Even for modules, though usage of 'our' should be discouraged except for VERSION and the like.
Third time lucky: +1

So now, do we add these coding guidelines? Perhaps under one rule about defining variables?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.koha-community.org/pipermail/koha-devel/attachments/20130925/f9d2579b/attachment.html>


More information about the Koha-devel mailing list