[Dbix-class] Components, overrides, and method call ordering

Matt S Trout dbix-class at trout.me.uk
Sun Aug 17 18:45:55 BST 2008


On Tue, Aug 12, 2008 at 09:18:26AM +1000, Jason Galea wrote:
> Hi all,
> 
> I have a component which overrides row methods and I have overridden one of 
> these methods in the table ResultSource as well.

That makes no sense. Row isn't 'isa' ResultSource.

> The method in the 
> ResultSource is being called before the method in the component whereas I 
> need the component method to be called first.
> 
> Is there a simple way the affect the order in which these methods are 
> called?

DBIx::Class uses C3 dispatch currently so method call ordering is resolved
via linearizing @ISA. If you want A's overrides to happen before B's, make
sure A is first in @ISA. If A already depends on B, just have it subclass
B and then you're guaranteed.

-- 
      Matt S Trout       Need help with your Catalyst or DBIx::Class project?
   Technical Director                    http://www.shadowcat.co.uk/catalyst/
 Shadowcat Systems Ltd.  Want a managed development or deployment platform?
http://chainsawblues.vox.com/            http://www.shadowcat.co.uk/servers/



More information about the DBIx-Class mailing list