[Koha-devel] $query vs $query

Marc Chantreux marc.chantreux at biblibre.com
Thu Jul 9 18:16:09 CEST 2009


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



More information about the Koha-devel mailing list