silence loud test
[dbsrgits/DBIx-Class.git] / Makefile.PL
CommitLineData
737416a4 1use inc::Module::Install 0.67;
fe650234 2use strict;
3use warnings;
76607ac8 4use POSIX ();
fe650234 5
6use 5.006001; # delete this line if you want to send patches for earlier.
ce4c07df 7
8name 'DBIx-Class';
ce4c07df 9perl_version '5.006001';
8e0f16f1 10all_from 'lib/DBIx/Class.pm';
ce4c07df 11
ce4c07df 12requires 'Data::Page' => 2.00;
13requires 'Scalar::Util' => 0;
87e75121 14requires 'SQL::Abstract' => 1.24;
15requires 'SQL::Abstract::Limit' => 0.13;
16requires 'Class::C3' => 0.20;
1680d317 17requires 'Class::C3::Componentised' => 0;
ce4c07df 18requires 'Storable' => 0;
ce4c07df 19requires 'Carp::Clan' => 0;
20requires 'DBI' => 1.40;
21requires 'Module::Find' => 0;
22requires 'Class::Inspector' => 0;
87e75121 23requires 'Class::Accessor::Grouped' => 0.08002;
f1b99b9e 24requires 'JSON::Any' => 1.17;
9c6d6d93 25requires 'Scope::Guard' => 0.03;
8026d0eb 26requires 'Path::Class' => 0;
26ab719a 27requires 'List::Util' => 1.19;
ddc0a6c8 28requires 'Sub::Name' => 0.04;
e0cdf2cb 29requires 'namespace::clean' => 0.09;
ce4c07df 30
31# Perl 5.8.0 doesn't have utf8::is_utf8()
32requires 'Encode' => 0 if ($] <= 5.008000);
33
d9a898ca 34configure_requires 'DBD::SQLite' => 1.14;
35
f947585b 36test_requires 'Test::Builder' => 0.33;
97aca715 37test_requires 'Test::Warn' => 0.11;
f947585b 38test_requires 'Test::Exception' => 0;
ce3b4eb9 39test_requires 'Test::Deep' => 0;
ce4c07df 40
41install_script 'script/dbicadmin';
42
50891152 43tests_recursive 't';
ce4c07df 44
1543db24 45# re-build README and require CDBI modules for testing if we're in a checkout
fe650234 46
47my @force_build_requires_if_author = qw(
48 DBIx::ContextualFetch
49 Class::Trigger
50 Time::Piece
a8e7500d 51 Clone
52 Test::Pod::Coverage
53 Test::Memory::Cycle
fe650234 54);
55
56if ($Module::Install::AUTHOR) {
57
58 foreach my $module (@force_build_requires_if_author) {
59 build_requires $module;
60 }
09d46657 61
1543db24 62 system('pod2text lib/DBIx/Class.pm > README');
ff132c6f 63}
64
65auto_provides;
66
3e110410 67auto_install;
68
e0b438fb 69# Have all prerequisites, check DBD::SQLite sanity
269228af 70if (! $ENV{DBICTEST_NO_SQLITE_CHECK} ) {
71
e0b438fb 72 my $pid = fork();
73 if (not defined $pid) {
74 die "Unable to fork(): $!";
75 }
76 elsif (! $pid) {
269228af 77
78 # Win32 does not have real fork()s so a segfault will bring
79 # everything down. Warn about it.
80 if ($^O eq 'MSWin32') {
81 print <<'EOW';
82
83######################################################################
84# #
85# A short stress-testing of DBD::SQLite will follow. If you have a #
86# buggy library this might very well be the last text you will see #
87# before the installation silently terminates. If this happens it #
88# would mean that you are running a buggy version of DBD::SQLite #
89# known to randomly segfault on errors. Even if you have the latest #
3951a291 90# CPAN module version, the system sqlite3 dynamic library might have #
91# been compiled against an older buggy sqlite3 dev library (oddly #
92# DBD::SQLite will prefer the system library against the one bundled #
93# with it). You are strongly advised to resolve this issue before #
94# proceeding. #
269228af 95# #
96# If this happens to you (this text is the last thing you see), and #
97# you just want to install this module without worrying about the #
98# tests (which will almost certainly fail) - set the environment #
99# variable DBICTEST_NO_SQLITE_CHECK to a true value and try again. #
100# #
101######################################################################
102
103EOW
104 }
105
e0b438fb 106 require DBI;
269228af 107 for (1 .. 100) {
e0b438fb 108 my $dbh;
109 $dbh = DBI->connect ('dbi:SQLite::memory:', undef, undef, {
110 AutoCommit => 1,
111 RaiseError => 0,
112 PrintError => 0,
113 })
114 or die "Unable to connect to database: $@";
115 $dbh->do ('CREATE TABLE name_with_no_columns'); # a subtle syntax error
116 $dbh->do ('COMMIT'); # followed by commit
117 $dbh->disconnect;
118 }
119
120 exit 0;
121 }
122 else {
76607ac8 123 eval {
124 local $SIG{ALRM} = sub { die "timeout\n" };
125 alarm 5;
126 wait();
127 alarm 0;
128 };
7a0e56cb 129 my $exception = $@;
130
e0b438fb 131 my $sig = $? & 127;
7a0e56cb 132
133# make sure process actually dies
134 $exception && kill POSIX::SIGKILL(), $pid;
135
136 if ($exception || $sig == POSIX::SIGSEGV() || $sig == POSIX::SIGABRT()
3c086319 137 || $sig == 7) { # 7 == SIGBUS, haven't seen it but just in case
e0b438fb 138 warn (<<EOE);
139
3951a291 140############################### WARNING #################################
141# #
142# You are running a buggy version of DBD::SQLite known to randomly #
143# segfault on errors. Even if you have the latest CPAN module version, #
144# the sqlite3 dynamic library on this system might have been compiled #
145# against an older buggy sqlite3 dev library (oddly DBD::SQLite will #
146# prefer the system library against the one bundled with it). You are #
147# strongly advised to resolve this issue before proceeding. #
148# #
149#########################################################################
e0b438fb 150
151EOE
152 my $ans = prompt (
153 "The test suite of this module is almost certain to fail.\n"
154 . 'Do you really want to continue?',
155 'no',
156 );
157 exit 0 unless ($ans =~ /^y(es)?$/i);
158 }
159 }
160}
161
162
43944e47 163WriteAll();
09d46657 164
165
166if ($Module::Install::AUTHOR) {
167 # Need to do this _after_ WriteAll else it looses track of them
168 Meta->{values}{build_requires} = [ grep {
fe650234 169 my $ok = 1;
170 foreach my $module (@force_build_requires_if_author) {
171 if ($_->[0] =~ /$module/) {
172 $ok = 0;
173 last;
174 }
175 }
176 $ok;
09d46657 177 } @{Meta->{values}{build_requires}} ];
178
179 my @scalar_keys = Module::Install::Metadata::Meta_TupleKeys();
fe650234 180 my $cr = Module::Install::Metadata->can("Meta_TupleKeys");
181 {
182 no warnings 'redefine';
183 *Module::Install::Metadata::Meta_TupleKeys = sub {
184 return $cr->(@_), 'resources';
185 };
09d46657 186 }
187 Meta->{values}{resources} = [
188 [ 'MailingList', 'http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class' ],
189 [ 'IRC', 'irc://irc.perl.org/#dbix-class' ],
100dd0a8 190 [ 'license', 'http://dev.perl.org/licenses/' ],
191 [ 'repository', 'http://dev.catalyst.perl.org/svnweb/bast/browse/DBIx-Class/' ],
09d46657 192 ];
193 Meta->write;
194}