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

Rod McChesney rod.mcchesney at gmail.com
Thu Feb 14 04:45:59 GMT 2008


> with the important caveat that relationships (has_a, has_many...) have to
be
> declared *after* all classes have been declared.

Could you expand on that a little? Not sure exactly what it means. Does it
means that you can't define the relationships with the class, but have
to run the has_* statements after all the relevant classes have been use'd
somewhere? Seems like that would be a Bad Thing...

Thx,

Rod

On Feb 13, 2008 4:31 PM, Michael G Schwern <schwern at pobox.com> wrote:

> DBIx::Class::CDBICompat is in fantastic shape for anyone curious about
> transitioning from Class::DBI to DBIx::Class.  It's down to really
> niggling,
> undocumented details, like the exact particulars of when lazy loading
> happens.
>
> The improved DBIx::Class::CDBICompat is not available on CPAN but only
> from
> its own branch.  It keeps up to date with trunk changes.  Eventually it
> will
> merge into trunk once I get the attention of a DBIC person for a couple
> hours.
>
> http://dev.catalyst.perl.org/repos/bast/DBIx-Class/0.08/branches/cdbicompat_integration
>
>
> The critical thing to realize is that this is *not* a subclass or wrapper
> around DBIx::Class but a series of plugins.  When you use CDBICompat you
> get
> DBIx::Class objects and all of DBIx::Class' features are available.  This
> allows one to ease into the new features offered by DBIx::Class without
> having
> to rewrite your whole code base.  One of the first things you'll want to
> look
> at is DBIx::Class::ResultSet for all it's advanced search() features.
>
> The CDBICompat documentation has been improved a bit to make it clearer
> how to
> use it and what the limitations are.  You should be able to just change
>
>        use base qw(Class::DBI);
>
> with
>
>        use base qw(DBIx::Class::CDBICompat);
>
> with the important caveat that relationships (has_a, has_many...) have to
> be
> declared *after* all classes have been declared.
>
>
> Bonus features:
>
> $obj->{column} now works.  I didn't want to emulate that hack, but the
> folks
> who are paying me to do this needed it.  Ironically, because it goes
> through a
> tied scalar, it will be slower than $obj->column().
>
> nocache() of Class::DBI::Plugin::NoCache is emulated so you can turn the
> object cache off.
>
> search_where() of Class::DBI::AbstractSearch is emulated, though there's
> not
> much point because DBIC's search is almost exactly the same and better.
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.digitalcraftsmen.net/pipermail/classdbi/attachments/20080213/f560e2b3/attachment.htm 


More information about the ClassDBI mailing list