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

Matt S Trout dbix-class at trout.me.uk
Mon Jul 28 22:36:13 BST 2008


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 );
> 
> sub new {
>    my ($me, $app, @rest) = @_;
> 
>    $me->config( connect_info => $app->config->{connect_info} );
>    $me->config( schema_class => $app->config->{schema_class} );

Right. Except now you just set global class data with that information.

And the feature's already there to do what you need, anyway - see Charlie
Garrison's post for how you -should- be doing it.

-- 
      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