[CDBI] has_many and Class::DBI::Template

Nigel Drego <[email protected]>
Newsgroups gmane.comp.lang.perl.modules.class-dbi
Message-ID <[email protected]>
I'm trying to use Class::DBI::Template but when I try to do a template
of this form:

MusicDB::Album->has_many(tracks => 'MusicDB::Track');

...

[% FOREACH track IN tracks %]
   [% track.tracknum %] - [% track.title %]
[% END %]

I don't get anything. If I do [% track %] what I end up getting is a
number - in fact the number of tracks. What it looks like is happening
is that between Class::DBI and Template::Toolkit, it's interpreting that
assignment to track as a scalar assignment rather than list-based and as
such Class::DBI->search (which is called deep within
Class::DBI::Relationship::HasMany) is returning a scalar, not a list.
Has anyone else seen this behavior? Is there a work-around? Am I doing
something wrong?

Thanks for any help!
Nigel.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.