--- Makefile.PL;-0	2012-09-03 11:38:44 -0500
+++ Makefile.PL	2012-09-22 22:17:01 -0500
@@ -4,6 +4,8 @@ use strict;
 use warnings;
 use lib 'ext';
 use inc::Module::Install;
+use Config;
+use File::Spec;
 
 name('Net-SSLeay');
 all_from('lib/Net/SSLeay.pm');
@@ -29,14 +31,17 @@ no_index( directory => qw( inc ext helpe
 resources( repository => 'http://svn.debian.org/wsvn/net-ssleay' );
 resources( bugtracker => 'https://rt.cpan.org/Public/Dist/Display.html?Name=net-ssleay' );
 
-postamble <<MAKE;
-constants.c : helper_script/regen_openssl_constants.pl
-	\$(ABSPERLRUN) helper_script/regen_openssl_constants.pl -gen-c constants.c
+my $regen_script = File::Spec->catfile('helper_script', 'regen_openssl_constants.pl');
+my $constants_t = File::Spec->catfile('t', 'local', '21_constants.t');
 
-t/local/21_constants.t : helper_script/regen_openssl_constants.pl
-	\$(ABSPERLRUN) helper_script/regen_openssl_constants.pl -gen-t t/local/21_constants.t
+postamble <<"MAKE";
+constants.c : $regen_script
+	\$(ABSPERLRUN) $regen_script -gen-c constants.c
 
-SSLeay.o : constants.c t/local/21_constants.t
+$constants_t : $regen_script
+	\$(ABSPERLRUN) $regen_script -gen-t $constants_t
+
+SSLeay$Config{'obj_ext'} : constants.c $constants_t
 
 MAKE
 
--- inc/Module/Install/PRIVATE/Net/SSLeay.pm;-0	2012-09-03 11:38:43 -0500
+++ inc/Module/Install/PRIVATE/Net/SSLeay.pm	2012-09-24 22:15:30 -0500
@@ -111,6 +111,17 @@ EOM
           push @{ $opts->{lib_links} }, qw( libeay32MD ssleay32MD libeay32 ssleay32 libssl32);
         }
     }
+    elsif ($^O eq 'VMS') {
+        if (-r 'sslroot:[000000]openssl.cnf') {      # openssl.org source install
+          @{ $opts->{lib_paths} } = 'SSLLIB';
+          @{ $opts->{lib_links} } = qw( ssl_libssl32.olb ssl_libcrypto32.olb );
+        }
+        elsif (-r 'ssl$root:[000000]openssl.cnf') {  # HP install
+            @{ $opts->{lib_paths} } = 'SYS$SHARE';
+            @{ $opts->{lib_links} } = qw( SSL$LIBSSL_SHR32 SSL$LIBCRYPTO_SHR32 );
+        }
+        @{ $opts->{lib_links} } = map { $_ =~ s/32\b//g } @{ $opts->{lib_links} } if $Config{use64bitall};
+    }
     else {
         $opts->{optimize} = '-O2 -g';
         push @{ $opts->{lib_links} },
@@ -144,8 +155,9 @@ my @nopath;
 sub check_no_path {            # On OS/2 it would be typically on default paths
     my $p;
     if (not($other_try++) and $] >= 5.008001) {
-       require ExtUtils::Liblist;              # Buggy before this
-       my ($list) = ExtUtils::Liblist->ext("-lssl");
+       use ExtUtils::MM;
+       my $mm = MM->new();
+       my ($list) = $mm->ext("-lssl");
        return unless $list =~ /-lssl\b/;
         for $p (split /\Q$Config{path_sep}/, $ENV{PATH}) {
            @nopath = ("$p/openssl$Config{_exe}",       # exe name
@@ -163,7 +175,7 @@ sub find_openssl_prefix {
         return $ENV{OPENSSL_PREFIX};
     }
 
-    my %guesses = (
+    my @guesses = (
             '/usr/bin/openssl'               => '/usr',
             '/usr/sbin/openssl'              => '/usr',
             '/opt/ssl/bin/openssl'           => '/opt/ssl',
@@ -175,9 +187,12 @@ sub find_openssl_prefix {
             'C:\OpenSSL\bin\openssl.exe'     => 'C:\OpenSSL',
             $Config{prefix} . '\bin\openssl.exe'      => $Config{prefix},           # strawberry perl
             $Config{prefix} . '\..\c\bin\openssl.exe' => $Config{prefix} . '\..\c', # strawberry perl
+            '/sslexe/openssl.exe'            => '/sslroot',  # VMS, openssl.org
+            '/ssl$exe/openssl.exe'           => '/ssl$root', # VMS, HP install
     );
 
-    while (my ($k, $v) = each %guesses) {
+    while (my $k = shift @guesses
+           and my $v = shift @guesses) {
         if ( -x $k ) {
             return $v;
         }
@@ -192,7 +207,7 @@ sub find_openssl_exec {
     my ($self, $prefix) = @_;
 
     my $exe_path;
-    for my $subdir (qw( bin sbin out32dll )) {
+    for my $subdir (qw( bin sbin out32dll ia64_exe alpha_exe )) {
         my $path = File::Spec->catfile($prefix, $subdir, "openssl$Config{_exe}");
         if ( -x $path ) {
             return $path;
--- t/local/06_tcpecho.t;-0	2012-09-03 11:38:43 -0500
+++ t/local/06_tcpecho.t	2012-09-25 18:42:26 -0500
@@ -2,10 +2,17 @@
 
 use strict;
 use warnings;
-use Test::More tests => 4;
+use Test::More;
 use Socket;
 use Symbol qw(gensym);
 use Net::SSLeay;
+use Config;
+
+BEGIN {
+  plan skip_all => "fork() not supported on $^O" unless $Config{d_fork};
+}
+
+plan tests => 4;
 
 my $sock;
 my $pid;
--- t/local/07_sslecho.t;-0	2012-09-03 11:38:44 -0500
+++ t/local/07_sslecho.t	2012-09-25 18:42:06 -0500
@@ -2,11 +2,18 @@
 
 use strict;
 use warnings;
-use Test::More tests => 78;
+use Test::More;
 use Socket;
 use File::Spec;
 use Symbol qw(gensym);
 use Net::SSLeay;
+use Config;
+
+BEGIN {
+  plan skip_all => "fork() not supported on $^O" unless $Config{d_fork};
+}
+
+plan tests => 78;
 
 my $sock;
 my $pid;
--- t/local/08_pipe.t;-0	2012-09-03 11:38:44 -0500
+++ t/local/08_pipe.t	2012-09-25 18:41:50 -0500
@@ -7,17 +7,15 @@ use Net::SSLeay;
 use Symbol qw( gensym );
 use IO::Handle;
 use File::Spec;
+use Config;
 
-if ($^O eq 'MSWin32')
-{
-    plan skip_all => 'pipes not properly supported on Windows' if 1;
-    exit;
-}
-else
-{
-    plan tests => 11;
+BEGIN {
+  plan skip_all => "Either pipes or fork() not supported on $^O"
+      if ($^O eq 'MSWin32' || !$Config{d_fork});
 }
 
+plan tests => 11;
+
 Net::SSLeay::randomize();
 Net::SSLeay::load_error_strings();
 Net::SSLeay::OpenSSL_add_ssl_algorithms();
--- t/local/40_npn_support.t;-0	2012-09-03 11:38:44 -0500
+++ t/local/40_npn_support.t	2012-09-25 07:20:42 -0500
@@ -7,9 +7,11 @@ use Socket;
 use File::Spec;
 use Symbol qw(gensym);
 use Net::SSLeay;
+use Config;
 
 BEGIN {
   plan skip_all => "openssl 1.0.1 required" unless Net::SSLeay::SSLeay >= 0x10001000;
+  plan skip_all => "fork() not supported on $^O" unless $Config{d_fork};
 }
 
 plan tests => 7; 
@@ -100,4 +102,4 @@ push @results, [$? == 0, 'server exited 
 END {
   Test::More->builder->current_test(3);
   ok( $_->[0], $_->[1] ) for (@results);
-}
\ No newline at end of file
+}
