[CDBI] has_many self reference

Aaron Trevena aaron.trevena at gmail.com
Wed Mar 1 15:07:59 GMT 2006


On 07/02/06, Perrin Harkins <perrin at elem.com> wrote:
> Hunter Thomas wrote:
> > Sad to say, fixing this was easy by switching to DBIx::Class. I didn't
> > have to deal with any of the hours of attempted debugging to get a
> > seemingly simple relation to function, it just worked as soon as I
> > defined it. Sorry to be negative about a mature package on it's own
> > list, but that's how I solved it for myself.
>
> Class::DBI::AutoLoader actually looks  more like an abandoned package
> than a mature one, given that the last update was two and a half years
> ago.  It looks like people stopped using it in favor of Class::DBI::Loader.

I believe this problem occurs in C::DBI rather than in or because of
AutoLoader.. There is a bug on rt (
http://rt.cpan.org/Public/Bug/Display.html?id=3305 ) describing a very
similar problem to what I have, with this same error message.

In my case I have several classes, but 1 fails to compile with 3.014,
but works fine in 0.9x.

I have 2 relevent classes - Task and TaskHistory..

TaskHistory has a Task on the TaskHistory task column
Task has many TaskHistory on the TaskHistory task column
Task has a last TaskHistory on the Task last_history column

When compiling with latest CDBI get the following error :
 can't load Schedule::Chronic::Distributed::Task: Can't locate object
method "meta_info" via package
"Schedule::Chronic::Distributed::TaskHistory" at
/usr/local/share/perl/5.8.4/Class/DBI/Relationship/HasMany.pm line 34.

I'm guessing that the new has_many code doesn't like me having both a
has_a and a has_many from one class to another, which is rather
unhelpful, removing the extra has_a relationship isn't a particular
hardship in this case but it does show a limitation in the new code
that isn't documented.

Cheers,

A.




More information about the ClassDBI mailing list