[Dbix-class] minimalistic Moose / DBIC glue module

Moritz Onken onken at houseofdesign.de
Wed May 26 04:11:53 GMT 2010


On Tue, 25 May 2010 21:28:45 +0200, BUCHMULLER Norbert <norbi.lists at nix.hu>
wrote:
> Hi Guys,
> 
> at the company where I work we are trying to make DBIC and Moose
> befriend: ie. making the Result (Row) objects regular Moose objects (as
> much as reasonable), so that we can use type constraints, triggers, ...
on
> columns as if they were normal attributes.
> 
> With the current best practice of double-declaring the accessors - ie.
> using both "has 'x' => ..." and "__PACKAGE__>add_columns('x', ...)" - it
> does not work, as Class::Accessor::Grouped overwrites the Moose-generated
> accessors with its own generated accessors; also it's ugly to repeat each
> column name. (Even if it had not overwritten it, it still wouldn't work
> for at least 2 reasons: 1. the slots accessed by the Moose accessors are
> in the top-level of the blessed hashref, while the CAG accessors
> generated by DBIC are in the hashref under '_column_data', 2. the Moose
> accessors don't know about inflation/deflation, the dirty flag, etc.)
> 
> I've heard about MooseX::DBIC, but we want something that works *now*.

Hi Norbert,

as author of MooseX::DBIC I'd like to point out that this is an
experimental
module written by me which has nothing to do with the planned DBIC
development towards Moose. As far as I remember v0.09 is meant to be 
moosified. I chose to write a custom result class for DBIC 0.08
to learn how to do meta programming with moose and to improve the
ugly DBIC syntax and add some goodies (lazy column loading etc.). 
As you mentioned, it's far from complete and adds some limitations 
(single primary key, etc).

Feel free to use the namespace. I'm not sure if it's even a good
idea to release this module since it might add some confusion
to newbies. Though, I hope my work is inspiration to the DBIC
dev team once they start working on the moosification.

Best regards,
moritz

http://github.com/monken/p5-moosex-dbic



More information about the DBIx-Class mailing list