use Module::Build;
use strict;
+use warnings FATAL => 'all';
-my $build = Module::Build->new(
+my $class = Module::Build->subclass(
+ class => "Module::Build::Custom",
+ code => <<'SUBCLASS' );
+
+sub ACTION_test {
+ my $self = shift;
+ if ( $self->notes('TEST_MYSQL_DSN') ) {
+ $ENV{$_} = $self->notes($_) for qw(
+ TEST_MYSQL_DSN TEST_MYSQL_USER TEST_MYSQL_PASS
+ );
+ }
+ foreach my $name ( qw( LONG_TESTS TEST_SQLITE ) ) {
+ $ENV{$name} = 1 if $self->notes( $name );
+ }
+}
+SUBCLASS
+
+my $build = $class->new(
module_name => 'DBM::Deep',
license => 'perl',
requires => {
'Fcntl' => '0.01',
'Scalar::Util' => '1.14',
'Digest::MD5' => '1.00',
- 'FileHandle::Fmode' => '0.05',
},
build_requires => {
'File::Path' => '0.01',
'File::Temp' => '0.01',
'Pod::Usage' => '1.3',
+ 'Test::More' => '0.88',
'Test::Deep' => '0.095',
'Test::Warn' => '0.08',
- 'Test::More' => '0.47',
'Test::Exception' => '0.21',
'IO::Scalar' => '0.01',
},
'META.yml', '*.bak', '*.gz', 'Makefile.PL', 'cover_db',
],
test_files => 't/??_*.t',
+ auto_features => {
+ sqlite_engine => {
+ description => 'DBI support via SQLite',
+ requires => {
+ 'DBI' => '1.5',
+ 'DBD::SQLite' => '1.25',
+ },
+ },
+ mysql_engine => {
+ description => 'DBI support via MySQL',
+ requires => {
+ 'DBI' => '1.5',
+ 'DBD::mysql' => '4.001',
+ },
+ },
+ },
);
+if ( $build->y_n( "Run the long-running tests", 'n' ) ) {
+ $build->notes( 'LONG_TESTS' => 1 );
+}
+
+if ( $build->features( 'sqlite_engine' ) ) {
+ if ( $build->y_n( "Run the tests against the DBI engine via SQLite?", 'n' ) ) {
+ $build->notes( 'TEST_SQLITE' => 1 );
+ }
+}
+
+if ( $build->features( 'mysql_engine' ) ) {
+ if ( $build->y_n( "Run the tests against the DBI engine via MySQL?", 'n' ) ) {
+ my ($dsn, $user, $pass) = ('') x 3;
+ $dsn = $build->prompt( "\tWhat is the full DSN (for example 'dbi:mysql:test')" );
+ if ( $dsn ) {
+ $user = $build->prompt( "\tWhat is the username?" );
+ if ( $user ) {
+ $pass = $build->prompt( "\tWhat is the password?" );
+ }
+ }
+
+ $build->notes( 'TEST_MYSQL_DSN' => $dsn );
+ $build->notes( 'TEST_MYSQL_USER' => $user );
+ $build->notes( 'TEST_MYSQL_PASS' => $pass );
+ }
+}
+
$build->create_build_script;