Tobias Kremer wrote:
Quoting Emmanuel Quevillon <[EMAIL PROTECTED]>:
I have a module DB::GenericTable.pm which reflects a
'generic' table schema into my database associated to a
table name in the DB.
I'd like to kow how can I access another table (different
name) but with the same schema (same column name, same
datatype) from my perl module? Someting like

I'd say by making a base table class and subclassing from it:

package DB::GenericTable;
use strict;
use warnings;
use base 'DBIx::Class';
__PACKAGE__->load_components("Core");
__PACKAGE__->table("genericname");
__PACKAGE__->add_columns(...);
1;

package DB::DerivedTable;
use strict;
use warnings;
use base 'DB::GenericTable';
__PACKAGE__->table("othertable");
1;

I really don't know if this works but you could give it a try!

--Tobias
Thanks Tobias for your quick reply.
It could be a solution, but the trick is that I'd like to be able to create a table (based on generic schema) from user' table name which can be anything....

Cheers
Emmanuel

--
-------------------------
Emmanuel Quevillon
Biological Software and Databases Group
Institut Pasteur
+33 1 44 38 95 98
tuco at_ pasteur dot fr
-------------------------

_______________________________________________
List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class
IRC: irc.perl.org#dbix-class
SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/
Searchable Archive: http://www.grokbase.com/group/[EMAIL PROTECTED]

Reply via email to