On 12/5/06, Hermida, Leandro <[EMAIL PROTECTED]> wrote:
Hello,

I remember seeing the question being asked before but I couldn't find it
in the archives.  How does one set up the model connect info to come
from the YAML configuration file?  Using the tutorial as an example, I
created the model file with the helper script myapp_create.pl:

$ script/myapp_create.pl model MyAppDB DBIC::Schema MyAppDB
dbi:SQLite:myapp.db '' '' '{ AutoCommit => 1 }'
     exists "/root/dev/MyApp/script/../lib/MyApp/Model"
     exists "/root/dev/MyApp/script/../t"
    created "/root/dev/MyApp/script/../lib/MyApp/Model/MyAppDB.pm"
    created "/root/dev/MyApp/script/../t/model_MyAppDB.t"

Inside MyApp::Model::MyAppDB:

use strict;
use base 'Catalyst::Model::DBIC::Schema';

__PACKAGE__->config(
    schema_class => 'MyAppDB',
    connect_info => [
        'dbi:SQLite:myapp.db',
        '',
        '',
        { AutoCommit => 1 },

    ],
);


How would I then make all of the connect info dynamic and acquired from
the myapp.yml file?  In particular the db driver (sqlite, mysql, pg,
oracle), host, port, username, password, etc.


Leandro


_______________________________________________
List: Catalyst@lists.rawmode.org
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/
Dev site: http://dev.catalyst.perl.org/

Hi, All!

Currently, I have something like:

__PACKAGE__->config(
   schema_class => 'MyAppBD',
   connect_info => [
       MyApp->config->{'db'},
       MyApp->config->{'db_user'},
       MyApp->config->{'db_password'},
       {AutoCommit => 1}
   ],
);

Regards.

_______________________________________________
List: Catalyst@lists.rawmode.org
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/
Dev site: http://dev.catalyst.perl.org/

Reply via email to