On Mon, Jun 23, 2008 at 02:31:41PM +0200, Emmanuel Quevillon wrote: > Hi, > > I am facing a problem (maybe a newbie one). > 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 > > package DB::GenericTable; > > use strict; > use warnings; > > use base 'DBIx::Class'; > > __PACKAGE__->load_components("Core"); > __PACKAGE__->table("genericname"); > __PACKAGE__->add_columns( > ... > ); > > 1; > > Later in my code : > > my $model = $schema->resultset('GenericTable'); > $model->table('my_other_table_name'); #Point to another table
Mm. $model->result_source($model->result_source->new($model->result_source)); $model->result_source->name('my_other_table_name'); Though I think you're probably insane and creating subclasses is going to be better. Maybe if you explained the use case better? -- Matt S Trout Need help with your Catalyst or DBIx::Class project? Technical Director http://www.shadowcat.co.uk/catalyst/ Shadowcat Systems Ltd. Want a managed development or deployment platform? http://chainsawblues.vox.com/ http://www.shadowcat.co.uk/servers/ _______________________________________________ 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]