[Dbix-class] Creating Result and ResultSet classes with Moo?

Marco marco.prado.bs at gmail.com
Wed Oct 14 18:36:39 GMT 2015


Excerpts from Robert Rothenberg's message of 2015-10-14 15:10:24 -0300:
> Hi All,
> 
> Is there a way to declare Result and ResultSet classes using Moo?
> Specifically, I'm looking for something that provides functions for
> declaring columns, e.g.
> 
>   has_column id => (
>     isa => Int,
>     autoincrement => 1,
>   );
> 
> I'm aware of DBIx::Class::MooseColumns, but that uses Moose.
> 
> Thanks,
> Rob
> 

Short answer: no.

But, you can easily write one. Although, I don't understand your reasons
to prefer Moo* declarations (Type checking maybe ?). 

You may want to wrap DBIx class with Moo* using an attribute trait, so you
can make your Moo* Classes to delegate to a DBIx classes.
Is not exactly a clever thing to do anyway, because at the end you are
gonna need some code to auto create the DBIX class from your attributes,
or even worse manual write the DBIx class underlining it.

The other option is to completely rewrite DBIx with Moo*.

-- 
Marco Arthur @ (M)arco Creatives



More information about the DBIx-Class mailing list