|XP is just a number|
Class::DBI and - possibly - complex data structuresby Evil Attraction (Novice)
|on Sep 05, 2003 at 19:28 UTC||Need Help??|
Evil Attraction has asked for the
wisdom of the Perl Monks concerning the following question:
I've been recommended Class::DBI by so many now, that I fell down on my kneed and tried it out properly. I've been fiddling with it previously too, but didn't like the outcome performance-wise. Anyway - I'm ready to give a new try.
My little test project deserves some help, though, as I'm having problems dealing with "complex" data structures. They aren't that complex, really, but putting them into a Class::DBI context seems more than trivial.
I have these tables:
As you can see, one Person can have more than one name. One extra question; it seems like Class::DBI forces you to name references without any ending '_id' if you want some nifty named methods in your classes?
Anyways - here are my classes;
My script might look something like this:
It works almost, except that even though the person has 2 different names, only one of them gets listed (twice).