AsForm and accessor names

[prev] [thread] [next] [Date index for 2004/12/21]

From: Dave Howorth
Subject: AsForm and accessor names
Date: 15:09 on 21 Dec 2004
Class::DBI::AsForm assumes that every column has an accessor with the 
same name. This is not true if accessors have been renamed using 
Class::DBI's accessor_name method. The result is an ugly death in the 
_to_*** functions when they invoke $self->$col.

To fix this, I believe code is needed in to_field along these lines:

     my $accessor = $class->can('accessor_name')
                 ? $class->accessor_name($field)
                 : $field;

$accessor then needs to be passed to each _to_*** function and 
$self->$col needs changing to $self->$accessor everywhere.

This breaks backward compatibility in the _to_*** call interfaces (why 
are they exported into my namespace anyway?) so I imagine there might be 
other opinions.

Cheers, Dave

AsForm and accessor names
Dave Howorth 15:09 on 21 Dec 2004

Re: AsForm and accessor names
Peter Speltz 21:17 on 30 Dec 2004

Re: AsForm and accessor names
Peter Speltz 22:18 on 30 Dec 2004

Re: AsForm and accessor names
Dave Howorth 12:11 on 05 Jan 2005

Generated at 12:15 on 16 Jan 2005 by mariachi v0.52