Clear questions and runnable code get the best and fastest answer |
|
PerlMonks |
Best Practices: Populating Objects from Databaseby mrborisguy (Hermit) |
on Nov 10, 2005 at 20:42 UTC ( [id://507532]=perlquestion: print w/replies, xml ) | Need Help?? |
mrborisguy has asked for the wisdom of the Perl Monks concerning the following question: I've been thinking about this for a little bit. My current context is in web programming, but I think this could be applied to a wider variety of programs. What, in your opinions, is the best way to populate a list of objects from a database? In the past, I've done things without classes at all, looking something like this:
But it seems like there should be a separation of getting all of the information about what could be an object, and what to do with that information. One thought would be something like:
Another thought would be to create a sub to populate the objects for me. When I think about this, though, I think about two things, really...
Maybe this is a bit of a meditation, but I'm definitely looking for some monks experienced in doing things like this to slap me with some wisdom, so let me know what you've done, and what you think is practically the best solution to populating a list of objects from a database. I'm sure there are some good ways to do this. I hope my question is clear. Thanks! -Bryan
Back to
Seekers of Perl Wisdom
|
|