DBD-PrimeBase
view release on metacpan or search on metacpan
Makefile.PL view on Meta::CPAN
#use strict;
use Config ();
use DBI::DBD ();
use Getopt::Long();
use ExtUtils::MakeMaker();
# See lib/ExtUtils/MakeMaker.pm for details of how to influence
# the contents of the Makefile that is written.
my $PB_HOME = $ENV{$PRIMEBASEHOME} || '/usr/local/primebase';
die qq{ The PRIMEBASEHOME environment variable must be set
to the installation location of the PrimeBase SDK or data server,
or the PrimeBase SDK or data server must be installed in it's
default location '/usr/local/primebase'.
} unless stat("$PB_HOME/lib/libpbapi.a");
################################################################
# Get PrimeBase server info.
use vars qw($opt);
$opt =
{ "help" => \&Usage,
};
Getopt::Long::GetOptions($opt, "help", "testdb=s", "testhost=s",
"testserver=s",
"testuser=s", "testpassword=s");
my $source = {};
foreach my $key (qw/testdb testhost testserver testuser testpassword/) {
Configure($opt, $source, $key);
}
print <<"MSG";
I will use the following settings for testing:
MSG
delete $opt->{'help'};
my $keylen = 0;
foreach my $key (keys %$opt) {
$keylen = length($key) if length($key) > $keylen;
}
my $slen = 0;
foreach my $val (values %$source) {
$slen = length($val) if length($val) > $slen;
}
foreach my $key (sort { $a <=> $b} keys %$opt) {
printf(" %-" . $keylen . "s (%-" . $slen . "s) = %s\n",
$key, $source->{$key}, $opt->{$key})
}
print <<"MSG";
To change these settings, see 'perl Makefile.PL --help' and
'perldoc INSTALL'.
MSG
sleep 5;
################################################################
# Generate the default environment settings file.
my($output);
$output=100;
open (output, ">t/PrimeBase.env");
foreach my $key (sort { $a <=> $b} keys %$opt) {
if ($key eq "testdb") {
printf output "\$ENV{'DBI_DATABASE'}='%s';\n", $opt->{$key};
} elsif ($key eq "testuser") {
printf output "\$ENV{'DBI_USER'}='%s';\n", $opt->{$key};
} elsif ($key eq "testpassword") {
printf output "\$ENV{'DBI_PASS'}='%s';\n", $opt->{$key};
( run in 0.971 second using v1.01-cache-2.11-cpan-f56aa216473 )