[CDBI] Changing Your Column Accessor Method Names

Derek Basch dbasch at yahoo.com
Mon Jun 19 21:17:10 BST 2006


Everyone,

I am gettting this error message:

Column 'id' in Database::Tql::Custdb clashes with built-in method at
class_dbi_test.pl line 26

and can't quite figure out how to fix it. I see there are several
solutions listed in the wiki:

http://wiki.class-dbi.com/wiki/Overriding_autogenerated_accessors

But they don't seem to do anything. Am I doing this (below) all wrong?

use strict;
use warnings;
use MysqlClientConfiguration;

package Database::Tql::DBI;
use base 'Class::DBI';

#sub id {
#   my $self = shift;
    # Back to normal Class::DBI
#    return $self->_id_accessor(@_);
#}

sub accessor_name {
  my ($class, $column) = @_;
  return "user_id" if $column eq "id";
  return $column;

}

Database::Tql::DBI->connection('dbi:mysql:Tql',
$MysqlClientConfiguration::mysql_user,
$MysqlClientConfiguration::mysql_password);

Thanks,
Derek Basch 

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 



More information about the ClassDBI mailing list