From: Peter Rabbitson Date: Fri, 31 Oct 2008 23:36:02 +0000 (+0000) Subject: Kill the install process at the MakeMaker stage if a dodgy DBD::SQLite is detected X-Git-Tag: v0.08240~279 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=e0b438fbf183279ad1dc824d52ead5102bf3cb20;p=dbsrgits%2FDBIx-Class.git Kill the install process at the MakeMaker stage if a dodgy DBD::SQLite is detected --- diff --git a/Makefile.PL b/Makefile.PL index a5bd70a..c1b6596 100644 --- a/Makefile.PL +++ b/Makefile.PL @@ -62,6 +62,56 @@ auto_provides; auto_install; +# Have all prerequisites, check DBD::SQLite sanity +{ + my $pid = fork(); + if (not defined $pid) { + die "Unable to fork(): $!"; + } + elsif (! $pid) { + require DBI; + for (1 .. 10) { + my $dbh; + $dbh = DBI->connect ('dbi:SQLite::memory:', undef, undef, { + AutoCommit => 1, + RaiseError => 0, + PrintError => 0, + }) + or die "Unable to connect to database: $@"; + $dbh->do ('CREATE TABLE name_with_no_columns'); # a subtle syntax error + $dbh->do ('COMMIT'); # followed by commit + $dbh->disconnect; + } + + exit 0; + } + else { + wait(); + my $sig = $? & 127; + if ($sig == 11) { + warn (<