[CDBI] Re: custom accessor problem?

adam adamlounds at gmail.com
Mon Mar 12 15:20:58 GMT 2007


On 3/9/07, adam <adamlounds at gmail.com> wrote:
<snip>
>
> I tracked this down to line 344 of Class/DBI.pm, in the
> _mk_column_accessors code, and I *think* that the line
>
>  %method = ('_' => $acc);         # make the accessor the mutator too
>
> should be
>
>  %method = ('_' => $default_accessor);
>
> instead, as when the code is called the values are
>
> $default_accessor = 'precise'
> $acc = '(convert (char(26), topic_updated_dt, 109))'
> $mut = 'precise'
>
> If I change the line in Class/DBI.pm then my code works as expected.
> However, I am loath to fiddle with Class::DBI itself if it's something
> that I'm doing wrong.
>
> Any ideas?

OK, looking at that again it breaks some code with using a custom
accessor_name_for sub. Reverting line 344 and adding the following
line around 362 (after the foreach my $type (keys %method) {}) works
better - leaving the custom accessor ($acc) method in place, but
adding an extra one based on $default_accessor as well.

$class->_make_method("${default_accessor}",
$class->make_ro_accessor($col->name_lc));

Any thoughts?
-- 
Adam



More information about the ClassDBI mailing list