Hello Monks:

I have a working catalyst app, "SamPool", to which I am adding some standalone scripts. I would like to move the database connection configuration from sampool.conf, which is where it is in my catalyst app, to SamPool.pm, SamPool::Model::DB, or even SamPool::Schema (which is where it is in the standalone app.)

As I read the catalyst faq, http://wiki.catalystframework.org/wiki/faq.view#Configuration, putting the info in SamPool.pm or SamPool::Model::DB should work, though settings placed in either of those would be overwritten by those in sampool.conf. But I cannot get settings placed in SamPool.pm (won't instantiate) or SamPool::Model::DB (won't connect) to work in catalyst.

Perhaps the fact that sampool.conf exists clobbers the settings in SamPool::Model::DB? Perhaps I have goofed in coding the settings when I moved them (though they work for the standalone scripts)?

sampool.conf excerpt

<Model::DB> schema_class SamPool::Schema <connect_info> dsn dbi:SQLite:__path_to(data,SamPool.db)__ </connect_info> </Model::DB>

This works for standalone app but not for catalyst:

SamPool::Model::DB excerpt

__PACKAGE__->config( schema_class => 'SamPool::Schema', connect_info => { dsn => 'dbi:SQLite:data/SamPool.db', user => '', password => '', } );

In reply to Placing Catalyst Database Connections Settings Outside .conf File by varanasi

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.