ARSperl
view release on metacpan or search on metacpan
Makefile.PL view on Meta::CPAN
print "\n";
}
sub makeTestConfig {
my ($SERVER, $USERNAME, $PASSWORD, $TCPPORT);
my ($S, $U, $P, $T) = ("", "", "", 0);
if(-e "./t/config.cache") {
do './t/config.cache';
$S = &CCACHE::SERVER;
$U = &CCACHE::USERNAME;
$P = &CCACHE::PASSWORD;
$T = &CCACHE::TCPPORT;
}
print "=== ARSperl 'make test' configuration. ===
Please enter the following information. This information will be
recorded in ./t/config.cache
If you want to skip the 'make test' step, just hit ENTER
three times. You can configure it later by either re-running
'perl Makefile.PL' or by editting ./t/config.cache
Fair warning: you probably don't want to run 'make test' against a
production ARSystem server.
";
( $SERVER, $USERNAME, $PASSWORD ) = ( '', '', '' );
print "Server Name [$S]: ";
chomp($SERVER = $ARSPERLTEST_SERVER || <STDIN>);
if($SERVER eq "") {
$SERVER = $S if ($S ne "");
}
print "Admin Username [$U]: ";
chomp($USERNAME = $ARSPERLTEST_USERNAME || <STDIN>);
if($USERNAME eq "") {
$USERNAME = $U if ($U ne "");
}
print "Admin Password [$P]: ";
chomp($PASSWORD = defined($ARSPERLTEST_PASSWORD) ? $ARSPERLTEST_PASSWORD : <STDIN>);
if($PASSWORD eq "") {
$PASSWORD = $P if ($P ne "");
}
print "TCP Port [$T]: ";
chomp($TCPPORT = defined($ARSPERLTEST_TCPPORT) ? $ARSPERLTEST_TCPPORT : <STDIN>);
if($TCPPORT eq "") {
$TCPPORT = $T if ($T ne "");
}
$TCPPORT = 0 if ! $TCPPORT;
#print "Storing $SERVER / $USERNAME / $PASSWORD ..\n";
open (FD, "> ./t/config.cache") || die "open failed: $!";
print FD "package CCACHE;\n";
print FD "\# enter your server, admin username and password below.\n\n";
print FD "sub SERVER { \"$SERVER\" ; }\n";
print FD "sub USERNAME { \"$USERNAME\" ; }\n";
print FD "sub PASSWORD { \"$PASSWORD\" ; }\n";
print FD "sub TCPPORT { $TCPPORT ; }\n";
print FD "1;\n";
close(FD);
}
#
# given a path to the Api directory, go find ar.h and parse the value
# of the AR_CURRENT_API_VERSION #define and return it.
# if the path to ar.h is, e.g.,
# c:\Program Files\ARSystem6.0.1\Arserver\Api\include\ar.h
# then this method wants an appropriately quoted
# c:\Program Files\ARSystem6.0.1\Arserver\Api
# as its first arg
#
sub findAPIVersion {
my $path_to_api_dir = shift;
my $ar_fname = join('/', $path_to_api_dir, 'include', 'ar.h');
open ($ar_fh, '<'. $ar_fname) or
die "couldn't open ar.h include file from: \"$ar_fname\": $!\n";
my $api_version = undef;
# the line we want to parse looks like:
#
##define AR_CURRENT_API_VERSION 10 /* current api version */
while (<$ar_fh>) {
chomp;
if (m/^\s*#define\s*AR_CURRENT_API_VERSION\s*(\d+)/) {
$api_version = $1;
last;
}
}
close $ar_fh;
return $api_version;
}
#
# given an API version from above, return the minimum server version
# that supports it.
# That is, if an API version is supported by multiple releases of the
# AR System Server, we return the chronologically first version
# since compiling against that version will have been the first
# time we have arsperl will have to change to support the API change.
#
# this whole strategy of deriving the server version from the api version
# presumes that we won't have to distinguish between releases of the
# same api version, which may or may not be correct.
#
# the api version can be the main variable arsperl uses to adjust
# itself however.
#
( run in 1.366 second using v1.01-cache-2.11-cpan-0d23b851a93 )