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?
_______________________________________________ Koha-devel mailing list [email protected] http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-devel website : http://www.koha-community.org/ git : http://git.koha-community.org/ bugs : http://bugs.koha-community.org/
