Module ::Plugin::DBIC has a D1 and a D2 version. The common part is DBICx::Sugar; it exports the 'schema' word. You can configure the schema in your Dancer config.yml -------- plugins: DBIC: example: schema_class: Example::Schema dsn: "dbi:SQLite:dbname=/var/db/example.db" -------- Look! No Dancer version! Now we can make the needed result class: -------- package MyApp::Model; # ABSTRACT: DBIx::Class interface for MyApp applications use strict; use warnings; use Exporter qw(import); use DBICx::Sugar qw(schema); our $VERSION = '0.01'; # VERSION our @EXPORT_OK = qw( rset_table1 ); sub _my_schema { return schema('example'); } sub rset_table1 { return _my_schema->resultset('Table1'); } 1; -------- Now you can use 'table1' in any module not knowing what Dancer version you are running under. -- Henk
participants (1)
-
Henk van Oers