[Dbix-class] Extending a schema after instanciating it

Guillaume Rousse Guillaume.Rousse at inria.fr
Sun Aug 17 19:43:23 BST 2008


Hello list.

I'm facing a strange problem with DBIx::Class. Due to the nature of my 
application (run-time discovery of configured plugins, each extending 
the basic schema), I need to load and deploy the schema class by class, 
after creating the schema. However, the following code does not work:

#!/usr/bin/perl
use strict;
use My::Schema;
use Data::Dumper;
my $schema = My::Schema->connect('dbi:SQLite:/home/guillaume/my.db');

print Dumper($schema->sources());
My::Schema->load_classes('Other');
print Dumper($schema->sources());

The 'Other' class is not registered.

I tried to call load_class on schema instance rather than class, it is 
even worse:
Bareword found where operator expected at (eval 98) line 1, near ")::Other"
	(Missing operator before ::Other?)
DBIx::Class::Schema::load_classes(): Can't modify require in scalar 
assignment at (eval 98) line 2, near ")::Other
"

Moving the load_class operation before the schema instanciation fix the 
issue, but not my needs :) I didn't found anything in DBIx::Class 
documentation about this problem, it is expected behaviour ?
-- 
Guillaume Rousse
Moyens Informatiques - INRIA Futurs
Tel: 01 69 35 69 62



More information about the DBIx-Class mailing list