[CDBI] State of the DBIx::Class Class::DBI compatibility layer

Michael G Schwern schwern at pobox.com
Thu Feb 14 10:06:50 GMT 2008


Victor Churchill wrote:
> On 14/02/2008, Michael G Schwern <schwern at pobox.com> wrote:
> 
> I was really excited to see this post, until this bit..
> 
>>  This is also problematic if you're generating the CDBI classes on the fly, say
>>  from some schema file.  You have to queue up the relationships until the end.
>>
>>  That part of CDBICompat was written by somebody else and I haven't messed with
>>  it.  I have some idea how to fix it, but AFAIK I'm the only one making serious
>>  use of CDBICompat.  And since most CDBI projects are one file, one class, one
>>  table I don't believe it to be pressing.
> 
> Is that serious? "One file, one class, one table?" I am using a
> "fairly complex" data model which involves a lot of navigation and,
> coming from a starting point of pure DBI+DBD, enjoyed the opportunity
> given me by CDBI to say $thisobj->{thisAttr}->{thatAttr}.

Please don't say that.  Say $thisobj->thisAttr->thatAttr.  I tore my hair out 
emulating $obj->{column} in CDBICompat because the code base I'm working on 
uses CDBI objects like hashes.


> And then
> was daunted by the prospect of migrating to DBIxC so this
> compatibility development looked like a Great Thing. So I am
> concerned...

I think we have another misinterpretation.

It's one CDBI class PER file.  You can certainly use multiple classes.

Let me make it clear.

Currently, in CDBICompat, if you declare a relationship to another class the 
foreign class either has to A) already be declared or B) has to be in a file 
that can be required.

If you have each class in its own file you're good.  Other CDBI projects might 
have to restructure how they declare their classes so the relationships are 
declared last.

I took another look at it and this limitation will be difficult to lift 
without changing how DBIC relationships work.


-- 
The interface should be as clean as newly fallen snow and its behavior
as explicit as Japanese eel porn.



More information about the ClassDBI mailing list