[Dbix-class] column accessor namespace

Dave Howorth dhoworth at mrc-lmb.cam.ac.uk
Thu Feb 2 13:47:01 CET 2006


I'm looking at moving from CDBI to DBIC for a variety of reasons.

One of the problems I have with CDBI is that it puts the column accessor 
methods into the same namespace as its own class methods and 
plugin-sourced methods. This combined with Perl's inability to 
distinguish a class call from an instance call (except by adding code at 
the start of every method) means that there can be conflicts between 
column accessors and predefined methods. For example, my column 
accessors called 'sequence' and 'primary' both caused problems.

So I was wondering what DBIC does about this issue. From a quick scan of 
the schemaintro doc, it looks like it has the same flaw. And a different 
set of predefined methods to conflict with :) For example, I really do 
have an accessor called 'belongs_to' :(

Is there a way around this problem? Some way to put all the accessors in 
a different, clean namespace for example. I know I could use a 
systematic renaming, a la Java (get_belongs_to, set_belongs_to etc) but 
I haven't got that desperate yet!

Cheers, Dave



More information about the Dbix-class mailing list