[Catalyst] Objects and persistence

Christopher Taranto christopher at tokpela.com
Fri Jan 30 16:57:04 GMT 2009

On Fri, January 30, 2009 7:43 am, Marco Vittorini Orgeas wrote:
> Hi,
> I am approching in those days the Catalyst framework.
> I am also quite new to persistence of Objects, and therefore before start
> building my application I need some clarifications, because I don't want
> to get myself in the wrong direction in the middle of the work. The point
> is:  let's say that I have a good amount of logic of my application coded
> in a Object oriented way with moose (thus I have all the goodness of a OO
> approach: so inheritance, moose rooles, moose checks of attributes' types
> and all what OO gives). Well from what I've read all I have to do to
> plug-in my code is just use my Objects and methods in some controller:
> now the problem is that I obviously need persistence. Now, always reading
> tutorials on the topic,seems that DBIx::Class is the common approach to
> map Objects to and from rdbms, but from what I've read from the code of
> this module I think there's slightly abuse of notation: the overmentioned
> module gives me a OO API to query my RDBM (as also class::DBI gives)hiding
> all the SQL operations from me(at least partially).Now I could be
> horribly wrong here...
> The problem is, how to "really" maps my (moose) objects to rdbm tables ?
> DBIx
> gives me his objects...to use "my" objects after have retrieved them I need
> some sort of casting or even re-create(bless) them from the retrieved
> informations of DBIx every time.
> Probably I should specify here that I am thinking at the problem
> after have seen how an OR mapper as Java's Hibernate approaches the Objects
> <--> RDBM problems...that is, strongly map your plain old java
> classes attributes to table fields, and after some cast I've back my POJOS.
> Again I could miss the whole point of DBIx:Class and his overall
> approach: casting or blessing again a lot of objects to apply them my
> classes methods is worth the overhead that this produce? Or it's better to
> play just with objectified retrieved informations and re-implement my
> objects roles (methodes) as controller subroutines and pass them DBIX
> objects?
> Thank you
> --
> Marco Vittorini Orgeas

Hi Marco,

I don't think this is a Catalyst/DBIx::Class issue as much as an object
serialization issue.  Once you have serialized your objects, certainly you
can store in the DB.

Check out this tutorial on Perlmonks:


Christopher Taranto

More information about the Catalyst mailing list