diff -up perl-5.10.1/installperl.orig perl-5.10.1/installperl
--- perl-5.10.1/installperl.orig	2009-08-13 16:40:10.023330816 -0600
+++ perl-5.10.1/installperl	2010-04-22 19:31:00.720633856 -0600
@@ -409,6 +409,11 @@ elsif ($Is_Cygwin) { # On Cygwin symlink
 	mkpath("$installarchlib/CORE/mpeix", $opts{verbose}, 0777);
 	push(@corefiles,'mpeix/mpeixish.h');
     }
+    if ($^O eq 'haiku') {
+	# Haiku needs haikuish.h installed as well.
+	mkpath("$installarchlib/CORE/haiku", $opts{verbose}, 0777);
+	push(@corefiles,'haiku/haikuish.h');
+    }
     # If they have built sperl.o...
     push(@corefiles,'sperl.o') if -f 'sperl.o';
 }
diff -up perl-5.10.1/lib/File/Temp.pm.orig perl-5.10.1/lib/File/Temp.pm
--- perl-5.10.1/lib/File/Temp.pm.orig	2009-06-30 07:13:54.062914560 -0600
+++ perl-5.10.1/lib/File/Temp.pm	2010-04-22 19:25:11.867172352 -0600
@@ -1978,7 +1978,8 @@ sub unlink0 {
     #   on Win9x the link count remains 1
     # On NFS the link count may still be 1 but we cant know that
     # we are on NFS
-    return ( $fh[3] == 0 or $^O eq 'cygwin' ? 1 : 0);
+    # On haiku, the link count seems to be always 1 (at least for BFS)
+    return ( $fh[3] == 0 or $^O eq 'cygwin' or $^O eq 'haiku' ? 1 : 0);
 
   } else {
     _deferred_unlink($fh, $path, 0);
diff -up perl-5.10.1/lib/File/Temp/t/lock.t.orig perl-5.10.1/lib/File/Temp/t/lock.t
--- perl-5.10.1/lib/File/Temp/t/lock.t.orig	2009-02-12 15:58:13.059506688 -0700
+++ perl-5.10.1/lib/File/Temp/t/lock.t	2010-04-22 19:25:11.860094464 -0600
@@ -8,7 +8,8 @@ use Fcntl;
 BEGIN {
 # see if we have O_EXLOCK
   eval { &Fcntl::O_EXLOCK; };
-  if ($@) {
+  if ($@  || $^O eq 'haiku') {
+    # haiku doesn't implement O_EXLOCK yet (but it defines the value)
     plan skip_all => 'Do not seem to have O_EXLOCK';
   } else {
     plan tests => 4;
diff -up perl-5.10.1/t/run/exit.t.orig perl-5.10.1/t/run/exit.t
--- perl-5.10.1/t/run/exit.t.orig	2009-08-04 09:48:30.001310720 -0600
+++ perl-5.10.1/t/run/exit.t	2010-04-22 19:25:11.870580224 -0600
@@ -57,18 +57,18 @@ is( ${^CHILD_ERROR_NATIVE}, $native_succ
 if (!$vms_exit_mode) {
   my $posix_ok = eval { require POSIX; };
   my $wait_macros_ok = defined &POSIX::WIFEXITED;
-  eval { POSIX::WIFEXITED(${^CHILD_ERROR_NATIVE}) };
+  eval { POSIX::WIFEXITED($?) };
   $wait_macros_ok = 0 if $@;
   $exit = run('exit 42');
   is( $exit >> 8, 42,             'Non-zero exit' );
   is( $exit, $?,                  'Non-zero exit $?' );
-  isnt( !${^CHILD_ERROR_NATIVE}, 0, 'Non-zero exit ${^CHILD_ERROR_NATIVE}' );
+  isnt( ${^CHILD_ERROR_NATIVE}, 0, 'Non-zero exit ${^CHILD_ERROR_NATIVE}' );
   SKIP: {
     skip("No POSIX", 3) unless $posix_ok;
     skip("No POSIX wait macros", 3) unless $wait_macros_ok;
-    ok(POSIX::WIFEXITED(${^CHILD_ERROR_NATIVE}), "WIFEXITED");
-    ok(!POSIX::WIFSIGNALED(${^CHILD_ERROR_NATIVE}), "WIFSIGNALED");
-    is(POSIX::WEXITSTATUS(${^CHILD_ERROR_NATIVE}), 42, "WEXITSTATUS");
+    ok(POSIX::WIFEXITED($?), "WIFEXITED");
+    ok(!POSIX::WIFSIGNALED($?), "WIFSIGNALED");
+    is(POSIX::WEXITSTATUS($?), 42, "WEXITSTATUS");
   }
 
   SKIP: {
@@ -87,9 +87,9 @@ if (!$vms_exit_mode) {
     SKIP: {
       skip("No POSIX", 3) unless $posix_ok;
       skip("No POSIX wait macros", 3) unless $wait_macros_ok;
-      ok(!POSIX::WIFEXITED(${^CHILD_ERROR_NATIVE}), "WIFEXITED");
-      ok(POSIX::WIFSIGNALED(${^CHILD_ERROR_NATIVE}), "WIFSIGNALED");
-      is(POSIX::WTERMSIG(${^CHILD_ERROR_NATIVE}), 15, "WTERMSIG");
+      ok(!POSIX::WIFEXITED($?), "WIFEXITED");
+      ok(POSIX::WIFSIGNALED($?), "WIFSIGNALED");
+      is(POSIX::WTERMSIG($?), 15, "WTERMSIG");
     }
   }
 
