Sunday, October 19, 2008

Catalyst: SQLite database location

Using SQLite databases for apps is quick and easy. If you move your app around you can keep your DBI connection pointed to a file that's relative to where the application is located, like so:

my $db = DocBox->path_to( qw(my app data info.db) );

__PACKAGE__->config(
schema_class => 'MyApp::Data::Info',
connect_info => [
"dbi:SQLite:$db"
],
);