Is there any way to limit access to Context->dbh to only the C4 Modules? Being able to enforce coding guidelines would be nice. Kyle http://www.kylehall.info Information Technology Crawford County Federated Library System ( http://www.ccfls.org ) On Thu, Jul 9, 2009 at 1:40 PM, Ryan Higgins<ryan.higgins@liblime.com> wrote:
I agree with Joe.
If we were to adopt a coding guideline out of this, it should be that only C4 modules may call Context->dbh().
And it wouldn't bother me to see CGI objects renamed as $cgi.
Ryan
2009/7/9 Joe Atzberger <ohiocore@gmail.com>:
3) Both are valid.
For the most part, SQL should be in C4 modules, and only .pl scripts should have CGI objects.
I am fine with 2a, using $cgi as a variable name, too, but I wouldn't spend much time on this.
-- Joe Atzberger LibLime - Open Source Library Solutions
On Thu, Jul 9, 2009 at 12:16 PM, Marc Chantreux <marc.chantreux@biblibre.com> wrote:
hello koha coders,
Koha naming convention drove us to a stupid bug: $query is used both for the CGI object and the SQL statements.
So at the end of an hard week, we write :
my $query = CGI->new; # lines of code $query = "delete * from my_brain"; # lines of code print $query->header;
and try to understand why header is not a function available in the weird "delete * from my_brain" package ...
so we would like to change at least one of these convention to prevent this easy error. As we are for a stronger coding style in koha, we feel that this decision must be debated with all of you.
proposals:
1. Change the sql statement name a) to $statement b) to $sql c) to $smt d) to an explicit name (as $select_old_borrowers or $update_items ...) e) to your own idea 2. Change the CGI object a) to $cgi (i have no idea why ...) b) to $r (as there is a lot of perl code still using this convention) c) to $input (because a part of koha already use it) d) to your own idea 3. I don't want to change because *you* did errors ... $query is ok for me!
for myself, i'm fan of 1d *and* 2a ($query is too generic and $input has no sense when i write print $input->header).
regards
-- Marc Chantreux BibLibre, expert en logiciels libres pour l'info-doc http://biblibre.com
_______________________________________________ Koha-devel mailing list Koha-devel@lists.koha.org http://lists.koha.org/mailman/listinfo/koha-devel
-- Ryan Higgins
LibLime * Open-Source Solutions for Libraries Featuring KohaZOOM ILS 888-564-2457 x704 _______________________________________________ Koha-devel mailing list Koha-devel@lists.koha.org http://lists.koha.org/mailman/listinfo/koha-devel