Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
144 changes: 96 additions & 48 deletions Makefile.PL
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
use 5.006; #our, weaken
use strict;

use ExtUtils::MakeMaker;

my %required =
(
'Set::Object' => 1.10,
"Test::More" => 0,
#"Date::Manip" => 0,
"Time::Piece" => 0,
"Class::Date" => 0,
#"Class::Date" => 0, #not used in modules and test suite
#"DateTime" => 0,
"Scalar::Util" => 1.14,
"Data::Lazy" => 0.6,
Expand All @@ -25,13 +25,13 @@ while (my ($module, $min_ver) = each %required) {
eval "use $mod_ver;";
if($@) {
if (exists $required_hard{$module}) {
$bomb_out = 1;
#$bomb_out = 1;
print STDERR ("$mod_ver not found.\n");
} elsif ( exists $required_soft{$module} ) {
print STDERR ("$mod_ver not found. Some tests and/or "
."functionality may be missing.\n");
} else {
$skip_tests = 1;
#$skip_tests = 1;
print STDERR ("$mod_ver not found. You will not be able "
."to run the test suite.\n");
}
Expand All @@ -44,15 +44,12 @@ use lib '.';

sub yes
{
print ' (Y/n) ';
return <STDIN> =~ /^(Y(e(s)?)?|A(YE|II+!*))?\n?$/i;
return prompt(' (Y/n) ','Y') =~ /^(Y(e(s)?)?|A(YE|II+!*))?\n?$/i;
}

sub yeah_no # it's an antipodean thing
{
print ' (N/y) ';
return <STDIN> =~ /^(Y(e(s)?)?|A(YE|II+!*))\n?$/i;

return prompt(' (N/y) ','N') =~ /^(Y(e(s)?)?|A(YE|II+!*))\n?$/i;
}

print q{Do you plan to run the test suite?
Expand Down Expand Up @@ -90,20 +87,35 @@ connection information from a previous installation. Should I use it?};

unless ($configured)
{
print q{
my ($use_tx, $use_subsel, $table_type) = (1, 1);
my $cs;
my ($user, $passwd);
if (eval { require Test::Database; 1;} && lc(prompt('use Test::Database?','Y')) eq 'y') {
my @db_handles = Test::Database->handles();
my $db;
foreach my $d (@db_handles) {
my $t = $d->dbd;
next if $t eq 'CSV' || $t eq 'DBM';
$db = $d;
}
do { $skip_tests = 1; goto NOTESTS } unless $db;
$cs = $db->dsn();
$user = $db->username();
$passwd = $db->password();
} else {
print q{
Please give me the login and password for accessing the test database.
I must be able to create and drop tables in that database.};

print "\n1) DBI connect string (omit the \'DBI:\' part): ";
my $cs = <STDIN>;
chop $cs;
$cs = prompt("\n1) DBI connect string (omit the \'DBI:\' part): ");
chomp $cs;
do { $skip_tests = 1; goto NOTESTS } unless $cs;

$cs = "dbi:$cs" unless $cs =~ /^dbi\:/i;
$cs = "dbi:$cs" unless $cs =~ /^dbi\:/i;

my ($use_tx, $use_subsel, $table_type) = (1, 1);

if ($cs =~ m/:mysql:/i) {
print q{
if ($cs =~ m/:mysql:/i) {
print q{
You have selected the MySQL back-end. Normally, subselects and
transactions are disabled for this database. However, if you are
using MySQL-Max, or some other MySQL version with InnoDB support
Expand All @@ -119,44 +131,41 @@ sub-select tests. It is not possible to use sub-selects with InnoDB
table types.

Use InnoDB tables};
unless (yeah_no()) {
$use_tx = 0;

print "Use sub-selects";
unless (yeah_no()) {
$use_subsel = 0;
}
} else {
$table_type = "InnoDB";
unless (yeah_no()) {
$use_tx = 0;

print "Use sub-selects";
unless (yeah_no()) {
$use_subsel = 0;
}
} else {
$table_type = "InnoDB";
}
}
}

my ($user, $passwd);
if ( $cs =~ /:sqlite:/i ) {
print q{
if ( $cs =~ /:sqlite:/i ) {
print q{
You have selected the SQLite back-end. Sub-selects will be disabled.
};
$use_subsel = 0;
$user = $passwd = "";
} else {
$use_subsel = 0;
$user = $passwd = "";
} else {

print "2) Login: ";
$user = <STDIN>;
chop $user;
$user = prompt('2) Login: ');
chomp $user;

print "3) Password: ";
$passwd = <STDIN>;
chop $passwd;
$passwd = prompt('3) Password:');
chomp $passwd;

}
}

print <<'MSG';
print <<'MSG';

Thank you. I am going to save this information to 't/CONFIG'.
If you have given me sensitive information, make sure to destroy
the file when the tests have been completed.
MSG

}
open CONFIG, '>t/CONFIG' or die "Cannot create 't/CONFIG', reason: $!";
print CONFIG "$cs\n$user\n$passwd\ntx_do = $use_tx\nsubselects = $use_subsel\n".($table_type?"table_type = $table_type\n":"");
close CONFIG;
Expand Down Expand Up @@ -201,10 +210,49 @@ find(sub {
};
}, "lib");

WriteMakefile(
'NAME' => 'Tangram',
'VERSION_FROM' => 'lib/Tangram.pm', # finds $VERSION
PREREQ_PM => \%required,
PM => \%PM,
test => { TESTS => $tests },
WriteMakefile1(
'NAME' => 'Tangram',
'VERSION_FROM' => 'lib/Tangram.pm', # finds $VERSION
PREREQ_PM => \%required,
TEST_REQUIRES => {
"Test::More" => 0,
},
MIN_PERL_VERSION => '5.006',
META_MERGE => {
resources => {
repository => 'https://github.com/samv/tangram',
},
},
'LICENSE' => 'GPL2',
PM => \%PM,
test => { TESTS => $tests },
);

sub WriteMakefile1 { #Compatibility code for old versions of EU::MM. Written by Alexandr Ciornii, version 0.23. Added by eumm-upgrade.
my %params=@_;
my $eumm_version=$ExtUtils::MakeMaker::VERSION;
$eumm_version=eval $eumm_version;
die "EXTRA_META is deprecated" if exists $params{EXTRA_META};
die "License not specified" if not exists $params{LICENSE};
if ($params{AUTHOR} and ref($params{AUTHOR}) eq 'ARRAY' and $eumm_version < 6.5705) {
$params{META_ADD}->{author}=$params{AUTHOR};
$params{AUTHOR}=join(', ',@{$params{AUTHOR}});
}
if ($params{TEST_REQUIRES} and $eumm_version < 6.64) {
$params{BUILD_REQUIRES}={ %{$params{BUILD_REQUIRES} || {}} , %{$params{TEST_REQUIRES}} };
delete $params{TEST_REQUIRES};
}
if ($params{BUILD_REQUIRES} and $eumm_version < 6.5503) {
#EUMM 6.5502 has problems with BUILD_REQUIRES
$params{PREREQ_PM}={ %{$params{PREREQ_PM} || {}} , %{$params{BUILD_REQUIRES}} };
delete $params{BUILD_REQUIRES};
}
delete $params{CONFIGURE_REQUIRES} if $eumm_version < 6.52;
delete $params{MIN_PERL_VERSION} if $eumm_version < 6.48;
delete $params{META_MERGE} if $eumm_version < 6.46;
delete $params{META_ADD} if $eumm_version < 6.46;
delete $params{LICENSE} if $eumm_version < 6.31;

WriteMakefile(%params);
}

3 changes: 2 additions & 1 deletion lib/Tangram.pm
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@

package Tangram;

use 5.006;
use strict;

use vars qw( $TRACE $DEBUG_LEVEL );
our ( $TRACE, $DEBUG_LEVEL );

$TRACE = (\*STDOUT, \*STDERR)[$ENV{TANGRAM_TRACE} - 1] || \*STDERR
if exists $ENV{TANGRAM_TRACE} && $ENV{TANGRAM_TRACE};
Expand Down
1 change: 1 addition & 0 deletions lib/Tangram/Relational.pm
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ package Tangram::Relational;
use Tangram::Relational::Engine;

use Carp qw(cluck);
use 5.006;
use strict;

sub new { bless { }, shift }
Expand Down
1 change: 1 addition & 0 deletions lib/Tangram/Schema.pm
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ package Tangram::Schema;
use Tangram::Schema::ClassHash;
use Tangram::Schema::Class;

use 5.006; #our, weaken
use strict;
#our @ISA = qw( SelfLoader );
use Carp;
Expand Down
1 change: 1 addition & 0 deletions lib/Tangram/Springfield.pm
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@


use 5.006;
use strict;

package SpringfieldObject;
Expand Down
1 change: 1 addition & 0 deletions lib/Tangram/Storage.pm
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package Tangram::Storage;

use 5.006;
use strict;

use Tangram::Storage::Statement;
Expand Down