DBIx::Class base result class

Posted by Rob on Stack Overflow See other posts from Stack Overflow or by Rob
Published on 2011-03-20T08:10:49Z Indexed on 2011/03/20 16:09 UTC
Read the original article Hit count: 227

Filed under:
|
|
|

Hi there,

I am trying to create a model for Catalyst by using DBIx::Class::Schema::Loader. I want the result classes to have a base class I can add methods to. So MyTable.pm inherits from Base.pm which inherits from DBIx::Class::core (default).

Somehow I cannot figure out how to do this. my create script is below, can anyone tell me what I am doing wrong? The script creates my model ok, but all resultset classes just directly inherit from DBIx::Class::core without my Base class in between.

#!/usr/bin/perl

use DBIx::Class::Schema::Loader qw/ make_schema_at /;

#specifically for the entities many-2-many relation
$ENV{DBIC_OVERWRITE_HELPER_METHODS_OK} = 1;

make_schema_at(
    'MyApp::Schema',
    { 
        dump_directory          => '/tmp',
        debug                   => 1, 
        overwrite_modifications => 1, 
        components              => ['EncodedColumn'],  #encoded password column
        use_namespaces          => 1,
        default_resultset_class => 'Base'
        },
    [ 'DBI:mysql:database=mydb;host=localhost;port=3306','rob', '******' ],
);

© Stack Overflow or respective owner

Related posts about mysql

Related posts about perl