[Dbix-class] delaying relationship loading

Paul Makepeace lists.rawmode.org at paulm.com
Sat Nov 19 12:09:00 CET 2005


[you can toss my last message in the moderation queue from the wrong
address; if anyone knows how to persuade Apple Mail to send from different
addresses based on recipient I'd love to know...]

Somewhat in the vein of initialize() but not directly addressing it:
One of the issues I'm seeing over and over is failures of class  
loading going unnoticed due to their being hidden during the  
relationship loading. Let's say A rel B, B is loaded in an eval  
"require B" during A's compilation phase. If this fails e.g. a syntax  
error in B it's dropped which makes debugging more difficult. This  
situation is quite severe when relationships span most or all of the  
schema; a lot of work is being done in BEGIN.

One skeleton solution I was thinking of was that the relationships  
could be recorded during compilation and then executed post- 
compilation e.g. in a CHECK block or via a method call,  
init_relationships() or some such. This could perhaps be presented in  
a module that installs this as a CHECK block.

Maybe the relationships could even be resolved lazily, e.g. when  
their accessor is first used.

Paul



More information about the Dbix-class mailing list