Subject: | Fix for Win32 |
Hi,
Attached is a patch to t/90-openssl-compat.t that will enable Crypt::OpenSSL::DSA-0.12 to test successfully on my Win32 perl. My perl (5.8.7) was built using the MinGW compiler (native Win32 port of gcc). Openssl was also built with the same compiler. I believe the same patch will work equally well for a perl and openssl that have been built on Win32 using MS Visual Studio compiler (but this belief is untested).
The module still doesn't build straight out of the box, however. It was necessary to provide appropriate 'LIBS' and 'INC' arguments to 'perl Makefile.PL'. Imho it would be sufficient to provide instructions about that aspect in the 'README' - though that (obviously) doesn't enable the module to be built by the automated CPAN.pm procedure.
The problem with 90-openssl-compat.t, as it was written, is that the "which" command is not implemented on Win32, it's unlikely that the openssl executable will be in "/usr/bin" (or even "/usr/local/bin"), and for the '-x' test to pass we need to provide it with the full path to the openssl executable. The patch avoids all of those pitfalls.
Cheers,
Rob
--- 90-opensssl-compat.t_fixed 2005-08-29 14:36:50.000000000 +1000
+++ 90-openssl-compat.t 2005-05-23 11:36:14.000000000 +1000
@@ -12,17 +12,9 @@
BEGIN { plan tests => 84 }
my $HAS_SHA1 = eval "use Digest::SHA1; 1;";
-my ($OPEN_SSL, $testable);
-if($^O !~ /mswin32/i) {
- $OPEN_SSL = `which openssl` || "/usr/bin/openssl";
- chomp $OPEN_SSL;
- $testable = -x $OPEN_SSL && $HAS_SHA1;
- }
-else {
- $OPEN_SSL = "openssl";
- eval{`openssl version`};
- if(!$@) {$testable = 1 && $HAS_SHA1}
- }
+my $OPEN_SSL = `which openssl` || "/usr/bin/openssl";
+chomp $OPEN_SSL;
+my $testable = -x $OPEN_SSL && $HAS_SHA1;
my $why_skip = $HAS_SHA1 ? "Need openssl binary in path" : "Need Digest::SHA1 to test";
my $dsa = Crypt::OpenSSL::DSA->generate_parameters( 512, "foo" );