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

"John Siracusa" <[email protected]> Thu, 14 Feb 2008 10:58:37 -0500
Newsgroups gmane.comp.lang.perl.modules.class-dbi
Message-ID <[email protected]>
On Thu, Feb 14, 2008 at 9:42 AM, Matt Sisk <sisk-LBXX0kWOOYtWk0Htik3J/[email protected]> 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