]> git.decadent.org.uk Git - maypole.git/blobdiff - ex/BeerDB.pm
Support DBD::SQLite2
[maypole.git] / ex / BeerDB.pm
index 64f69541ba97aa4cf398a664dd0f438b1c5eb2b6..6df04914611ad19d1f176209c53c49917015cac4 100644 (file)
@@ -1,11 +1,18 @@
 package BeerDB;
-use Maypole::Application qw/-Debug/;
+use Maypole::Application;
 use Class::DBI::Loader::Relationship;
 
+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.