diff options
author | Siep Kroonenberg <siepo@cybercomm.nl> | 2008-01-21 11:54:44 +0000 |
---|---|---|
committer | Siep Kroonenberg <siepo@cybercomm.nl> | 2008-01-21 11:54:44 +0000 |
commit | 462e2d2731c8090524462bcb34bc4f9c6bd27035 (patch) | |
tree | f661ebd5d8373fe612ba102fcc5ac3b14d06eadd /Master/tlpkg/tlperl/lib/Win32/API/Test.pm | |
parent | e3ba2219d4fbf28b0aea070574369b62f7215391 (diff) |
Perl library:
- moved around some stuff (lib/lib -> lib)
- updated Win32::API
- removed Env.pm; code incorporated in TLWinGoo
- patched new API.pm for now
git-svn-id: svn://tug.org/texlive/trunk@6347 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/tlpkg/tlperl/lib/Win32/API/Test.pm')
-rw-r--r-- | Master/tlpkg/tlperl/lib/Win32/API/Test.pm | 120 |
1 files changed, 120 insertions, 0 deletions
diff --git a/Master/tlpkg/tlperl/lib/Win32/API/Test.pm b/Master/tlpkg/tlperl/lib/Win32/API/Test.pm new file mode 100644 index 00000000000..6cbeed6bfac --- /dev/null +++ b/Master/tlpkg/tlperl/lib/Win32/API/Test.pm @@ -0,0 +1,120 @@ +# +# Win32::API::Test - Test helper package for Win32::API +# +# Version: 0.01 +# Date: 23 Dec 2006 +# Author: Cosimo Streppone <cosimo@cpan.org> +# +# $Id: API.pm,v 1.0 2001/10/30 13:57:31 dada Exp $ +# +package Win32::API::Test; + +sub compiler_name () { + 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); +} + +# +# Run the compiler and get version from there... +# User might be running a compiler different from +# that used to build perl. +# For example, Cosimo does. For testing, of course. +# +# *** +# *** IT DOES NOT WORK NOW. +# *** FOR REASONS I DON'T KNOW, CL.EXE OUTPUTS ITS +# *** VERSION STRING IN THE FIRST TWO LINES THAT +# *** I'M NOT ABLE TO CATCH... +# *** +# +sub compiler_version_from_shell () { + my $cc = compiler_name(); + my $ver; + # MSVC + if($cc eq 'cl') + { + my @ver = `$cc`; + my $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`); + 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); +} + +1; + +__END__ + + +####################################################################### +# DOCUMENTATION +# + +=head1 NAME + +Win32::API::Test - Test helper package for Win32::API + +=head1 SYNOPSIS + + my $test_dll = Win32::API::Test::find_test_dll('API_test.dll'); + +Check the t/*.t test scripts for more details. + +=head1 DESCRIPTION + +Simple package to hold Win32::API test suite helper functions. +No more, no less. + +=head1 AUTHOR + +Cosimo Streppone ( I<cosimo@cpan.org> ) + +=cut |