On Fri, Jan 22, 2010 at 11:33 AM, Tomas Doran wrote:
On 21 Jan 2010, at 18:36, Rodrigo wrote:

So ideally I would like to have DB entities represented by a single Moose
class, rather than in 2 or more places. For that there's KiokuDB and
MooseX::NonMoose-- the latter should allow a moose class to inherit from a
DBIC class. Haven't tried neither, though.
You can just use Moose in your DBIC classes..

You end up double declaring stuff (which is non optimum), and Moose comes
after DBIC (as you replace the simple dbic accessors with more complex Moose
stuff), but it works fine..
I haven't tried this yet, but just had the idea of using
MooseX::Role::Parameterized to fetch the column info and create the
Moose accessors in a role based on what is defined.

Then, just define an extra type that corresponds to a Moose type, or
just some basic rules (varchar/char => Str, etc)

__PACKAGE__->add_columns( 'foo' => { datatype => 'varchar', extra => {
type => 'Str' } } );

I've been meaning to give this a play and see if it works... thoughts?


Search Discussions

Discussion Posts


Follow ups

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 6 of 7 | next ›
Discussion Overview
groupcatalyst @
categoriescatalyst, perl
postedJan 21, '10 at 5:37p
activeJan 22, '10 at 8:31p



site design / logo © 2022 Grokbase