In February I 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' :(
I got a few suggestions in reply to this and recently I started to experiment with DBIC. It's been going really well. Thanks! Today I tried to connect to the database that has a table with a column called 'belongs_to'. It failed and because I'd forgotten about this issue I initially found the error message very confusing: DBIx::Class::Schema::Loader::connection(): Can't fetch data as class method at ./compare-db.pl line 76 My code is just: use QD1::Schema; my $schema = QD1::Schema->connection($dsn, $dbuser, $dbpass); and my Schema module is just: package QD1::Schema; use base qw/DBIx::Class::Schema::Loader/; __PACKAGE__->loader_options(relationships => 1); 1; It would be nice if name clashes were detected and explicitly reported, so as to produce meaningful error reports like CDBI does :) Cheers, Dave _______________________________________________ List: http://lists.rawmode.org/cgi-bin/mailman/listinfo/dbix-class Wiki: http://dbix-class.shadowcatsystems.co.uk/ IRC: irc.perl.org#dbix-class SVN: http://dev.catalyst.perl.org/repos/bast/trunk/DBIx-Class/ Searchable Archive: http://www.mail-archive.com/[email protected]/
