summaryrefslogtreecommitdiff
path: root/Master/tlpkg/tlperl/lib/Win32/API/Test.pm
diff options
context:
space:
mode:
Diffstat (limited to 'Master/tlpkg/tlperl/lib/Win32/API/Test.pm')
-rw-r--r--Master/tlpkg/tlperl/lib/Win32/API/Test.pm125
1 files changed, 67 insertions, 58 deletions
diff --git a/Master/tlpkg/tlperl/lib/Win32/API/Test.pm b/Master/tlpkg/tlperl/lib/Win32/API/Test.pm
index 0b21ced6927..55bf600b666 100644
--- a/Master/tlpkg/tlperl/lib/Win32/API/Test.pm
+++ b/Master/tlpkg/tlperl/lib/Win32/API/Test.pm
@@ -1,30 +1,35 @@
#
# Win32::API::Test - Test helper package for Win32::API
-#
+#
# Cosimo Streppone <cosimo@cpan.org>
#
-# $Id: Test.pm 438 2008-10-02 22:51:55Z cosimo.streppone $
package Win32::API::Test;
+sub is_perl_64bit () {
+ use Config;
+
+ # was $Config{archname} =~ /x64/;
+ return 1 if $Config{ptrsize} == 8;
+ return;
+}
+
sub compiler_name () {
- use Config;
- my $cc = $Config{ccname};
- if($cc eq 'cl' || $cc eq 'cl.exe')
- {
- $cc = 'cl';
- }
- return($cc);
+ use Config;
+ my $cc = $Config{ccname};
+ if ($cc eq 'cl' || $cc eq 'cl.exe') {
+ $cc = 'cl';
+ }
+ return ($cc);
}
sub compiler_version () {
- use Config;
- my $ver = $Config{ccversion} || 0;
- if( $ver =~ /^(\d+\.\d+)/ )
- {
- $ver = 0 + $1;
- }
- return($ver);
+ use Config;
+ my $ver = $Config{ccversion} || 0;
+ if ($ver =~ /^(\d+\.\d+)/) {
+ $ver = 0 + $1;
+ }
+ return ($ver);
}
#
@@ -34,50 +39,54 @@ sub compiler_version () {
# For example, Cosimo does. For testing, of course.
#
sub compiler_version_from_shell () {
- my $cc = compiler_name();
- my $ver;
- # MSVC
- if($cc eq 'cl')
- {
- my @ver = `$cc 2>&1`; # Interesting output in STDERR
- $ver = join('',@ver);
- #print 'VER:'.$ver.':'."\n";
- if($ver =~ /Version (\d[\d\.]+)/ms )
- {
- $ver = $1;
- }
- }
- # GCC
- elsif($cc eq 'cc' || $cc eq 'gcc' || $cc eq 'winegcc' )
- {
- $ver = join('', `$cc --version`);
- if($ver =~ /gcc.*(\d[\d+]+)/ms )
- {
- $ver = $1;
- }
- }
- # Borland C
- elsif($cc eq 'bcc32' || $cc eq 'bcc')
- {
- $ver = join('', `$cc 2>&1`);
- if($ver =~ /Borland C\+\+ (\d[\d\.]+)/ms )
- {
- $ver = $1;
- }
- }
- return($ver);
+ my $cc = compiler_name();
+ my $ver;
+
+ # MSVC
+ if ($cc eq 'cl') {
+ my @ver = `$cc 2>&1`; # Interesting output in STDERR
+ $ver = join('', @ver);
+
+ #print 'VER:'.$ver.':'."\n";
+ if ($ver =~ /Version (\d[\d\.]+)/ms) {
+ $ver = $1;
+ }
+ }
+
+ # GCC
+ elsif ($cc eq 'cc' || $cc eq 'gcc' || $cc eq 'winegcc') {
+ $ver = join('', `$cc --version`);
+ if ($ver =~ /gcc.*(\d[\d+]+)/ms) {
+ $ver = $1;
+ }
+ }
+
+ # Borland C
+ elsif ($cc eq 'bcc32' || $cc eq 'bcc') {
+ $ver = join('', `$cc 2>&1`);
+ if ($ver =~ /Borland C\+\+ (\d[\d\.]+)/ms) {
+ $ver = $1;
+ }
+ }
+ return ($ver);
}
-sub find_test_dll () {
- require File::Spec;
- my $dll_name = $_[0];
- my @paths = qw(.. ../t ../t/dll . ./dll ./t/dll);
- while(my $path = shift @paths)
- {
- $dll = File::Spec->catfile($path, $dll_name);
- return $dll if -s $dll;
- }
- return(undef);
+sub find_test_dll {
+ require File::Spec;
+
+ my $default_dll_name =
+ is_perl_64bit()
+ ? 'API_test64.dll'
+ : 'API_test.dll';
+
+ my $dll_name = $_[0] || $default_dll_name;
+
+ my @paths = qw(.. ../t ../t/dll . ./dll ./t/dll);
+ while (my $path = shift @paths) {
+ $dll = File::Spec->catfile($path, $dll_name);
+ return $dll if -s $dll;
+ }
+ return (undef);
}
1;