Re: [CDBI] CDBI "collections" and Class::DBI::Iterator

Perrin Harkins <[email protected]>
Newsgroups gmane.comp.lang.perl.modules.class-dbi
Message-ID <[email protected]>
Tom Metro wrote:
> I had a need to write some methods that operated on collections of CDBI 
> records, and wondered what was the preferred approach and in what module 
> those methods should live.

They go in the class that you want to end up with objects from.

> In the existing code I was working on there was a parent record type and 
> a child record type with a parent->has_many(child) type relationship set 
> up. The methods for dealing with bunches of child records currently 
> lived in the parent class, which seemed out of place.

I'd put the custom SQL methods in the child and maybe add methods in the 
parent that call the new methods in the child.

- Perrin
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.