-# This is the sample application. Change this to the path to your
-# database. (or use mysql or something)
-eval { require DBD::SQLite };
-if ($@) {
- BeerDB->setup("dbi:SQLite2:t/beerdb.db");
-} else {
- BeerDB->setup("dbi:SQLite:t/beerdb.db");
-}
+ my $dbi_driver = DBI_DRIVER;
+ if ($dbi_driver =~ /^SQLite/) {
+ die sprintf "SQLite datasource '%s' not found, correct the path or "
+ . "recreate the database by running Makefile.PL", DATASOURCE
+ unless -e DATASOURCE;
+ eval "require DBD::SQLite";
+ if ($@) {
+ eval "require DBD::SQLite2" and $dbi_driver = 'SQLite2';
+ }
+ }
+ BeerDB->setup(join ':', "dbi", $dbi_driver, DATASOURCE);