[Jifty-commit] r5381 - in Runops-Hook/trunk: lib/Runops

Jifty commits jifty-commit at lists.jifty.org
Wed May 7 09:13:59 EDT 2008


Author: nothingmuch
Date: Wed May  7 09:13:58 2008
New Revision: 5381

Modified:
   Runops-Hook/trunk/Hook.xs
   Runops-Hook/trunk/lib/Runops/Hook.pm

Log:
always pass by reference, sometimes the value on the stack is a PV[CAH]V and that causes Bizarre copy errors

Modified: Runops-Hook/trunk/Hook.xs
==============================================================================
--- Runops-Hook/trunk/Hook.xs	(original)
+++ Runops-Hook/trunk/Hook.xs	Wed May  7 09:13:58 2008
@@ -159,15 +159,15 @@
 		case ARITY_LIST:
 			/* repeat stack from the op's mark to SP just before we started pushing */
 			for (list_mark = PL_stack_base + *(PL_markstack_ptr-1); list_mark < orig_sp;) {
-				XPUSHs(*++list_mark);
+				XPUSHs(sv_2mortal(newRV(*++list_mark)));
 			}
 
 			break;
 
 		case ARITY_BINARY:
-			XPUSHs(*(orig_sp - 1));
+			XPUSHs(sv_2mortal(newRV(*(orig_sp - 1))));
 		case ARITY_UNARY:
-			XPUSHs(*orig_sp);
+			XPUSHs(sv_2mortal(newRV(*orig_sp)));
 			break;
 
 		case ARITY_NULL:

Modified: Runops-Hook/trunk/lib/Runops/Hook.pm
==============================================================================
--- Runops-Hook/trunk/lib/Runops/Hook.pm	(original)
+++ Runops-Hook/trunk/lib/Runops/Hook.pm	Wed May  7 09:13:58 2008
@@ -9,6 +9,15 @@
 our @ISA = qw(DynaLoader);
 __PACKAGE__->bootstrap;
 
+sub import {
+	my ( $class, @args ) = @_;
+
+	if ( @args == 1 and ref($args[0]) ) {
+		set_hook($args[0]);
+		enable();
+	}
+}
+
 1;
 
 __END__


More information about the Jifty-commit mailing list