]> git.decadent.org.uk Git - maypole.git/blobdiff - Makefile.PL
Support DBD::SQLite2
[maypole.git] / Makefile.PL
index 345bf6bf8d1926979f4f73b1d84581da02f8192b..ad8fcdbcaac3289447e642be2edd7250c66c35da 100644 (file)
@@ -47,10 +47,16 @@ sub has_module {
 if ( !-e "t/beerdb.db" ) {
     print "Making SQLite DB\n";
     eval { require DBD::SQLite };
-    die "No, wait, we don't have SQLite installed. Never mind\n" if $@;
-    require DBI;
-    my $dbh = DBI->connect("dbi:SQLite:dbname=t/beerdb.db");
-
+    my $dbh;
+    if ($@) {
+        eval { require DBD::SQLite2 };
+        die "No, wait, we don't have SQLite installed. Never mind\n" if $@;
+        require DBI;
+        $dbh = DBI->connect("dbi:SQLite2:dbname=t/beerdb.db");
+    } else {
+        require DBI;
+        $dbh = DBI->connect("dbi:SQLite:dbname=t/beerdb.db");
+    }
     my $sql = join( '', (<DATA>) );
 
     for my $statement ( split /;/, $sql ) {