in reply to Re: Re: Getting HASHES out of Class::DBI
in thread Getting HASHES out of Class::DBI

If you are going to use objects to access a database, then Class::DBI will typically make that easier and save you code. Before I started using it, I would write my own data access objects from scratch. Class::DBI has made that unnecessary, or at least removed the boring parts of it.

I don't think that the usefulness of Class::DBI for a particular application has much to do with the size or complexity of your database. I do think it has a lot to do with your approach to coding and whether or not you like accessing your data as objects.

When I've used Class::DBI with HTML::Template, I found it pretty easy to copy data from a list of objects into a hash structure that H::T could handle. I definitely was writing code to handle that translation, but that's the price you pay for the strong abstraction layer that H::T provides you. If you want a templating system that doesn't require you to arrange your data like this, Template Toolkit is happy to work on Class::DBI objects directly.

  • Comment on Re: Re: Re: Getting HASHES out of Class::DBI

Replies are listed 'Best First'.
Re: Re: Re: Re: Getting HASHES out of Class::DBI
by jdtoronto (Prior) on Jan 07, 2004 at 04:35 UTC
    When I've used Class::DBI with HTML::Template, I found it pretty easy to copy data from a list of objects into a hash structure that H::T could handle. I definitely was writing code to handle that translation, but that's the price you pay for the strong abstraction layer that H::T provides you. If you want a templating system that doesn't require you to arrange your data like this, Template Toolkit is happy to work on Class::DBI objects directly.
    Well perrin I think you have hit it on the head. I thought again about my remarks on DB complexity. Perhaps Class::DBI is no more and no less capable of handling complex relationships than anything else. What I was complaining about was the translation, and I think a couple of suggestions have been made that I will ponder overnight.

    As always, thanks for the insightful contribution.

    John jdtoronto

    PS: Template Toolkit is on my list of things to learn when this job is complete!