[Catalyst] Re: Catalyst::TraitFor::Model::DBIC::Schema::Replicated connect info

Rafael Kitover rkitover at cpan.org
Mon Jun 7 19:58:11 GMT 2010


On Fri, Jun 04, 2010 at 07:19:37PM -0700, Bill Moseley wrote:
... 
> Then try with my actual YAML:
> 
>     balancer_args:
>       master_read_weight: 0.3
>     connect_info:
>       - dbi:Pg:dbname=test
>       -
>       -
> 
>     replicants:
>       -
>         - dbi:Pg:dbname=slave
>         -
>         -
>     traits:
>       - Replicated
> 
> 
> Use of uninitialized value $driver in concatenation (.) or string at
> /usr/local/share/perl/5.10.0/DBIx/Class/Storage/DBI.pm line 935.
> DBIx::Class::Storage::throw_exception(): Can't locate
> DBIx/Class/Storage/DBI/.pm in @INC
> 
> 
> The hash-base connect_info works fine.
...

I think the extra blank line after the connect_info portion is throwing
it off.

I used this YAML successfully in my tutorial app:

Model::DB:
    schema_class: MyApp::Schema
    traits:
      - Caching
      - Replicated
    connect_info:
      - dbi:SQLite:myapp.db
      -
      -
    replicants:
      - 
        - dbi:SQLite:myapp2.db
        -
        -
      - 
        - dbi:SQLite:myapp3.db
        -
        -
      - 
        - dbi:SQLite:myapp4.db
        -
        -
    balancer_args:
      master_read_weight: 0.3

However, there is nothing wrong with using the hashref form, that is
actually preferred.

The arrayref form was used in the SYNOPSIS only to make the example more
concise.

The ::DBI::Replicated storage, to my knowledge, has only been tested on
MySQL. If you are using it successfully with Postgres I would love to
hear the details. Which replication software you are using, and does it
work as you expect.



More information about the Catalyst mailing list