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