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

John Siracusa siracusa at gmail.com
Thu Feb 14 15:58:37 GMT 2008


On Thu, Feb 14, 2008 at 9:42 AM, Matt Sisk <sisk at mojotoad.com> wrote:
> Matt Sisk wrote:
>  > 2) an END block handles processing the relationships after everything
>  > has loaded
>
>  Scratch that. Not enough caffeine today.

There's no need to use END blocks or source filters or any other
language hooks.  All you need to do is defer setup steps whose
participants are not yet ready, then keep revisiting that list of
deferred items each time a new DBIC class appears to see if any of
them now get the green light.

The only useful explicit step is to perhaps check to make sure the
list of deferred items is empty at the very end of <whatever you're
doing>.  But even that is not really necessary since sometimes you may
just want to load a subset of your classes and leave some
relationships unconfigured.  A happy medium is just to add an AUTOLOAD
that dumps out the list of "deferred but never actually completed"
items in response to bad method calls.

-John



More information about the ClassDBI mailing list