[Dbix-class] column accessor namespace
Matt S Trout
dbix-class at trout.me.uk
Thu Feb 2 23:31:12 CET 2006
On Thu, Feb 02, 2006 at 12:47:01PM +0000, Dave Howorth wrote:
> 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' :(
So don't try and call the relationship helper of that name :)
Unless you override ->inflate_result or ->result_source, the vast majority of
the object stuff should be happy enough ...
--
Matt S Trout Offering custom development, consultancy and support
Technical Director contracts for Catalyst, DBIx::Class and BAST. Contact
Shadowcat Systems Ltd. mst (at) shadowcatsystems.co.uk for more information
+ Help us build a better perl ORM: http://dbix-class.shadowcatsystems.co.uk/ +
More information about the Dbix-class
mailing list