+BEGIN {
+ my $dbi_driver = DBI_DRIVER;
+ if ($dbi_driver =~ /^SQLite/) {
+ unless -e (DATASOURCE) {
+ die sprintf("SQLite datasource '%s' not found, correct the path or recreate the database by running Makefile.PL", DATASOURCE), "\n";
+ }
+ eval "require DBD::SQLite";
+ if ($@) {
+ eval "require DBD::SQLite2" and $dbi_driver = 'SQLite2';
+ }
+ }
+ BeerDB->setup(join ':', "dbi", $dbi_driver, DATASOURCE);
+}