Author: Martin Petricek <mp@pdfedit.cz>
Date:   Sun Nov 6 22:21:11 2016 +0100

    Partial fix for perlapi 5.24

diff --git Permute.xs Permute.xs
index 4b47499..116a92c 100644
--- Permute.xs
+++ Permute.xs
@@ -472,6 +472,8 @@ SV* array_sv;
     struct afp_cache *c;
     I32 hasargs = 0;
     SV** newsp;
+    OP *retop     = PL_op->op_next;
+    I32 old_ss_ix = PL_savestack_ix;
   PPCODE:
 {
     if (!SvROK(callback_sv) || SvTYPE(SvRV(callback_sv)) != SVt_PVCV)
@@ -533,8 +535,8 @@ SV* array_sv;
     SAVETMPS;
     SAVESPTR(PL_op);
 
-    PUSHBLOCK(cx, CXt_NULL, SP);  /* make a pseudo block */
-    PUSHSUB(cx);
+    cx = cx_pushblock(CXt_NULL, gimme, MARK, old_ss_ix);  /* make a pseudo block */
+    cx_pushsub(cx, callback, retop, hasargs);
 
     old_catch = CATCH_GET;
     CATCH_SET(TRUE);
@@ -543,6 +545,6 @@ SV* array_sv;
     permute_engine(c->array, AvARRAY(c->array), 0, c->len, 
         c->tmparea, CvSTART(callback));
     
-    POPBLOCK(cx,PL_curpm);
+    cx_popblock(cx);
     CATCH_SET(old_catch);
 }

