Fix test in t/91debug.t for less ambigious SQL bracketing for 0.08013 release
[dbsrgits/DBIx-Class.git] / Makefile.PL
1 use inc::Module::Install 0.81;
2
3 name     'DBIx-Class';
4 perl_version '5.006001';
5 all_from 'lib/DBIx/Class.pm';
6
7 requires 'Data::Page'                => 2.00;
8 requires 'Scalar::Util'              => 0;
9 requires 'SQL::Abstract'             => 1.51;
10 requires 'SQL::Abstract::Limit'      => 0.13;
11 requires 'Class::C3'                 => 0.20;
12 requires 'Class::C3::Componentised'  => 1.0004;
13 requires 'Storable'                  => 0;
14 requires 'Carp::Clan'                => 0;
15 requires 'DBI'                       => 1.40;
16 requires 'Module::Find'              => 0;
17 requires 'Class::Inspector'          => 0;
18 requires 'Class::Accessor::Grouped'  => 0.08003;
19 requires 'JSON::Any'                 => 1.17;
20 requires 'Scope::Guard'              => 0.03;
21 requires 'List::Util'                => 1.19;
22
23 # Perl 5.8.0 doesn't have utf8::is_utf8()
24 requires 'Encode'                    => 0 if ($] <= 5.008000);  
25
26 test_requires 'DBD::SQLite'         => 1.14;
27 test_requires 'Test::Builder'       => 0.33;
28 test_requires 'Test::Exception'     => 0;
29 test_requires 'Test::Deep'          => 0;
30
31 install_script 'script/dbicadmin';
32
33 tests "t/*.t t/*/*.t";
34
35 # re-build README and require CDBI modules for testing if we're in a checkout
36 if( -e 'inc/.author' ) {
37   build_requires 'DBIx::ContextualFetch';
38   build_requires 'Class::Trigger';
39   system('pod2text lib/DBIx/Class.pm > README');
40 }
41
42 auto_provides;
43
44 auto_install;
45 # Have all prerequisites, check DBD::SQLite sanity
46 if (! $ENV{DBICTEST_NO_SQLITE_CHECK} ) {
47
48   # Win32 does not have real fork()s so a segfault will bring
49   # everything down. Warn about it.
50   if ($^O eq 'MSWin32') {
51     print <<'EOW';
52
53 ######################################################################
54 #                                                                    #
55 # A short stress-testing of DBD::SQLite will follow. If you have a   #
56 # buggy library this might very well be the last text you will see   #
57 # before the installation silently terminates. If this happens it    #
58 # would mean that you are running a buggy version of DBD::SQLite     #
59 # known to randomly segfault on errors. Even if you have the latest  #
60 # CPAN module version, the system sqlite3 dynamic library might have #
61 # been compiled against an older buggy sqlite3 dev library (oddly    #
62 # DBD::SQLite will prefer the system library against the one bundled #
63 # with it). You are strongly advised to resolve this issue before    #
64 # proceeding.                                                        #
65 #                                                                    #
66 # If this happens to you (this text is the last thing you see), and  #
67 # you just want to install this module without worrying about the    #
68 # tests (which will almost certainly fail) - set the environment     #
69 # variable DBICTEST_NO_SQLITE_CHECK to a true value and try again.   #
70 #                                                                    #
71 ######################################################################
72
73 EOW
74   }
75
76   my $pid = fork();
77   if (not defined $pid) {
78       die "Unable to fork(): $!";
79   }
80   elsif (! $pid) {
81
82       require DBI;
83       for (1 .. 100) {
84           my $dbh;
85           $dbh = DBI->connect ('dbi:SQLite::memory:', undef, undef, {
86               AutoCommit => 1,
87               RaiseError => 0,
88               PrintError => 0,
89           })
90               or die "Unable to connect to database: $@";
91           $dbh->do ('CREATE TABLE name_with_no_columns');   # a subtle syntax error
92           $dbh->do ('COMMIT');                              # followed by commit
93           $dbh->disconnect;
94       }
95
96       exit 0;
97   }
98   else {
99       wait();
100       my $sig = $? & 127;
101       if ($sig == 11) {
102           warn (<<EOE);
103
104 ############################### WARNING #################################
105 #                                                                       #
106 # You are running a buggy version of DBD::SQLite known to randomly      #
107 # segfault on errors.  Even if you have the latest CPAN module version, #
108 # the sqlite3 dynamic library on this system might have been compiled   #
109 # against an older buggy sqlite3 dev library (oddly DBD::SQLite will    #
110 # prefer the system library against the one bundled with it). You are   #
111 # strongly advised to resolve this issue before proceeding.             #
112 #                                                                       #
113 #########################################################################
114
115 EOE
116           my $ans = prompt (
117             "The test suite of this module is almost certain to fail.\n"
118             . 'Do you really want to continue?',
119             'no',
120           );
121           exit 0 unless ($ans =~ /^y(es)?$/i);
122       }
123   }
124 }
125
126 WriteAll;