johnnywang has asked for the wisdom of the Perl Monks concerning the following question:

Hi, I'm seeing the following behavior of capitalization of method names for Class::DBI (comments in the code, code not runnable, would need db):
package Foo use base 'Class::DBI'; # declare columns to be capital letters to # coincide with database column names. Foo->columns(All=>qw/ID STATUS/); # In the place where Foo is used my $foo = Foo->retrieve(100); # getters $foo->STATUS(); # ok $foo->get('STATUS'); # ok $foo->Status(); # ok $foo->get('Status'); # ok # setters $foo->STATUS(3); # ok $foo->Status(3); # not ok: can't locate object method Status $foo->set('STATUS',3); # ok $foo->set('Status',3); # ok # elements in @columns are all lower cased my @columns = $foo->columns;
Basically there seems to be some inconsistency as to the cases of method names, and columns are lower cased internally. Any comments as to the reason?

Replies are listed 'Best First'.
Re: lower case column names for Class::DBI
by perrin (Chancellor) on Nov 11, 2004 at 16:40 UTC
    The reason columns are lower-cased internally? Probably to avoid issues with inconsistent capitalization in SQL statements or unpredictable returns from databases. You'd be better off asking on the Class::DBI list.