1 use inc::Module::Install 0.67;
6 use 5.006001; # delete this line if you want to send patches for earlier.
9 perl_version '5.006001';
10 all_from 'lib/DBIx/Class.pm';
12 requires 'DBD::SQLite' => 1.23;
13 requires 'Data::Page' => 2.00;
14 requires 'Scalar::Util' => 0;
15 requires 'SQL::Abstract' => 1.51;
16 requires 'SQL::Abstract::Limit' => 0.13;
17 requires 'Class::C3::Componentised' => 1.0005;
18 requires 'Storable' => 0;
19 requires 'Carp::Clan' => 0;
20 requires 'DBI' => 1.40;
21 requires 'Module::Find' => 0;
22 requires 'Class::Inspector' => 0;
23 requires 'Class::Accessor::Grouped' => 0.08003;
24 requires 'JSON::Any' => 1.17;
25 requires 'Scope::Guard' => 0.03;
26 requires 'Path::Class' => 0;
27 requires 'List::Util' => 1.19;
28 requires 'Sub::Name' => 0.04;
29 requires 'MRO::Compat' => 0.09;
31 # Perl 5.8.0 doesn't have utf8::is_utf8()
32 requires 'Encode' => 0 if ($] <= 5.008000);
34 # configure_requires so the sanity check below can run
35 configure_requires 'DBD::SQLite';
37 test_requires 'Test::Builder' => 0.33;
38 test_requires 'Test::Warn' => 0.11;
39 test_requires 'Test::Exception' => 0;
40 test_requires 'Test::Deep' => 0;
42 recommends 'SQL::Translator' => 0.09004;
44 install_script 'script/dbicadmin';
48 # re-build README and require extra modules for testing if we're in a checkout
50 my %force_requires_if_author = (
51 'Test::Pod::Coverage' => 1.04,
52 'SQL::Translator' => 0.09004,
55 'DBIx::ContextualFetch' => 0,
56 'Class::DBI::Plugin::DeepAbstractSearch' => 0,
57 'Class::Trigger' => 0,
62 'Test::Memory::Cycle' => 0,
65 'DateTime::Format::MySQL' => 0,
69 ? ('Sys::SigAction'=> 0)
73 # t/93storage_replication.t
75 'MooseX::AttributeHelpers' => 0.12,
77 # t/96_is_deteministic_value.t
78 'DateTime::Format::Strptime' => 0,
81 if ($Module::Install::AUTHOR) {
83 foreach my $module (keys %force_requires_if_author) {
84 build_requires ($module => $force_requires_if_author{$module});
87 system('pod2text lib/DBIx/Class.pm > README');
92 if ($Module::Install::AUTHOR) {
94 ******************************************************************************
95 ******************************************************************************
97 *** AUTHOR MODE: all optional test dependencies converted to hard requires ***
99 ******************************************************************************
100 ******************************************************************************
106 # Have all prerequisites, check DBD::SQLite sanity
107 _check_sqlite() if (! $ENV{DBICTEST_NO_SQLITE_CHECK} );
111 if ($Module::Install::AUTHOR) {
112 # Need to do this _after_ WriteAll else it loses track of them
113 Meta->{values}{build_requires} = [ grep {
115 foreach my $module (keys %force_requires_if_author) {
116 if ($_->[0] =~ /$module/) {
122 } @{Meta->{values}{build_requires}} ];
124 my @scalar_keys = Module::Install::Metadata::Meta_TupleKeys();
125 my $cr = Module::Install::Metadata->can("Meta_TupleKeys");
127 no warnings 'redefine';
128 *Module::Install::Metadata::Meta_TupleKeys = sub {
129 return $cr->(@_), 'resources';
132 Meta->{values}{resources} = [
133 [ 'MailingList', 'http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class' ],
134 [ 'IRC', 'irc://irc.perl.org/#dbix-class' ],
135 [ 'license', 'http://dev.perl.org/licenses/' ],
136 [ 'repository', 'http://dev.catalyst.perl.org/svnweb/bast/browse/DBIx-Class/' ],
142 # This is legacy code. Latest DBD::SQLite developments fixed all known bugs
143 # in this area. Remove before some arbitrary next version
146 # Win32 does not have real fork()s so a segfault will bring
147 # everything down. Warn about it below, and don't try fork()
148 if ($^O ne 'MSWin32') {
151 if (not defined $pid) {
152 die "Unable to fork(): $!";
159 local $SIG{ALRM} = sub { die "timeout\n" };
168 # make sure process actually dies
169 $exception && kill POSIX::SIGKILL(), $pid;
171 if ($exception || $sig == POSIX::SIGSEGV() || $sig == POSIX::SIGABRT()
172 || $sig == 7) { # 7 == SIGBUS, haven't seen it but just in case
175 ############################### WARNING #################################
177 # You are running a buggy version of DBD::SQLite known to randomly #
178 # segfault on errors. Even if you have the latest CPAN module version, #
179 # the sqlite3 dynamic library on this system might have been compiled #
180 # against an older buggy sqlite3 dev library (oddly DBD::SQLite will #
181 # prefer the system library against the one bundled with it). You are #
182 # strongly advised to resolve this issue before proceeding. #
184 #########################################################################
188 "The test suite of this module is almost certain to fail.\n"
189 . 'Do you really want to continue?',
192 exit 0 unless ($ans =~ /^y(es)?$/i);
197 else { # the win32 version
200 ######################################################################
202 # A short stress-testing of DBD::SQLite will follow. If you have a #
203 # buggy library this might very well be the last text you will see #
204 # before the installation silently terminates. If this happens it #
205 # would mean that you are running a buggy version of DBD::SQLite #
206 # known to randomly segfault on errors. Even if you have the latest #
207 # CPAN module version, the system sqlite3 dynamic library might have #
208 # been compiled against an older buggy sqlite3 dev library (oddly #
209 # DBD::SQLite will prefer the system library against the one bundled #
210 # with it). You are strongly advised to resolve this issue before #
213 # If this happens to you (this text is the last thing you see), and #
214 # you just want to install this module without worrying about the #
215 # tests (which will almost certainly fail) - set the environment #
216 # variable DBICTEST_NO_SQLITE_CHECK to a true value and try again. #
218 ######################################################################
226 sub _torture_sqlite {
230 my $dbh = DBI->connect ('dbi:SQLite::memory:', undef, undef, {
234 }) or die "Unable to connect to database: $@";
236 $dbh->do ('CREATE TABLE name_with_no_columns'); # a subtle syntax error
237 $dbh->do ('COMMIT'); # followed by commit