Moose with Rose::DB::Object. Roose? Morose?

Yeah, I know it sounds silly. I’ve now read the Rose::DB::Object tutorial and the Moose manual several times and can’t wait to get started on my current and future projects using these technologies.

I find Rose::DB::Object to be a refreshing change over all the ORMs out there, and I especially like the concept of Manager classes. The docs are quite well written with several practical examples and its a good read to review your knowledge of database design too.

Moose is all the hype these days. Its so easy to get started using it and again - the manual is well written.

So I’m wondering how I will use these two modules together to get a persistent object system in my applications. From my searches, I found that there are examples of where people have used Moose and DBIx::Class together, but I couldn’t find samples with Rose::DB::Object. Anyway, I’ve decided to tackle this myself.

One Response to “Moose with Rose::DB::Object. Roose? Morose?”

  1. John Says:

    One issue you may encounter is that both Moose and Rose::DB::Object define and rely on a method named meta(). (For the record, Rose::DB::Object had it first.) This means that you can’t make a Rose::DB::Object-derived class that also inherits from Moose, and you can’t make a Moose class that inherits from a Rose::DB::Object-derived class.

    What people usually do instead is use composition rather than inheritance. That is, make a Moose-derived class that “has a” Rose::DB::Object-derived object within it, rather than one that “is a” (i.e., inherits from) Rose::DB::Object. The reverse will also work: a Rose::DB::Object-derived object that “has a” Moose-derived object.

    Good luck! And don’t forget about the Rose::DB::Object mailing list if you run into any problems: http://groups.google.com/group/rose-db-object

Leave a Reply