[Dbix-class] Configuration query - Catalyst::Model::DBIC::Schema

Matt S Trout dbix-class at trout.me.uk
Wed Jul 30 11:29:18 BST 2008


On Tue, Jul 29, 2008 at 09:15:42AM +0100, Dermot wrote:
> 2008/7/28 Matt S Trout <dbix-class at trout.me.uk>:
> > On Mon, Jul 28, 2008 at 02:02:04PM +0100, Peter Flanigan wrote:
> >> Dermot wrote:
> >> >I don't want to hard-code the path to the SQLite file but unless I do
> >> >I am getting DBI Connection failed: unable to open database file(1)
> >> >after a login attempt.
> >>
> >> package YourApp::Model::YourModel;
> >>
> >> use base qw(Catalyst::Model::DBIC::Schema);
> >>
> >> __PACKAGE__->config( connect_info => [], schema_class => undef );
> >>
> 
> I don't want to stray off the topic.  I used
> 
> <connect_info>
>       driver dbi:SQLite
>       file __HOME__/motion.db
> </connect_info>
> 
> in my conf file to get around a problem with an import script I made
> in ~/script/
> 
> I needed to s/__HOME__/$HOME/ to allow the script to populate the
> SQLite db. This script would be run periodically so it needs to work
> in conjunction with everything else.

that explains __HOME__ versus path_to.

my key point was "put the connect_info in the right damn place".
 
> To throw more tinder onto the fire, I am struggling to get Charlie's
> solution to work. Charlie's solution was were I started from. The book
> had it the same way but in YAML format. I tried
> 
> <Model::MyAppDB>
>  connect_info   dbi:SQLite:__HOME__/motion.db
   connect_info   dummy_username
> </Model::MyAppDB>

will work. Though I'd use <Model MyAppDB> ... </Model> cos it's prettier.

I should probably fix C::M::DBICL::Schema so you don't need that.

> It will however start with
> <model::MyAppDB>
> ...
> 
> Which I find strange.

because that key doesn't match anything so that config stanza is a complete
no-op - and hence doesn't trigger anything, bugs included.

-- 
      Matt S Trout       Need help with your Catalyst or DBIx::Class project?
   Technical Director                    http://www.shadowcat.co.uk/catalyst/
 Shadowcat Systems Ltd.  Want a managed development or deployment platform?
http://chainsawblues.vox.com/            http://www.shadowcat.co.uk/servers/



More information about the DBIx-Class mailing list