]> git.decadent.org.uk Git - maypole.git/blobdiff - ex/BeerDB.pm
Support DBD::SQLite2
[maypole.git] / ex / BeerDB.pm
index 1e84b36147f4b5f5e7ad2192220435f5d94296e5..6df04914611ad19d1f176209c53c49917015cac4 100644 (file)
@@ -7,7 +7,12 @@ sub debug { $ENV{BEERDB_DEBUG} }
 BEGIN {
 # This is the sample application. Change this to the path to your
 # database. (or use mysql or something)
-BeerDB->setup("dbi:SQLite:t/beerdb.db");
+eval { require DBD::SQLite };
+if ($@) {
+   BeerDB->setup("dbi:SQLite2:t/beerdb.db");
+} else {
+    BeerDB->setup("dbi:SQLite:t/beerdb.db");
+}
 }
 
 # Give it a name.