]> git.vpit.fr Git - perl/modules/indirect.git/blobdiff - indirect.xs
Also pass the file and the line number to the hook
[perl/modules/indirect.git] / indirect.xs
index f3aa14b4ce3c11f009c3d7b79d6d7b3fa2b4bb5e..b9314ae60a2e92298ff50c63a2c8029373f93a5c 100644 (file)
 # define sv_catpvn_nomg sv_catpvn
 #endif
 
+#ifndef mPUSHu
+# define mPUSHu(U) PUSHs(sv_2mortal(newSVuv(U)))
+#endif
+
 #ifndef HvNAME_get
 # define HvNAME_get(H) HvNAME(H)
 #endif
@@ -513,17 +517,29 @@ STATIC OP *indirect_ck_entersub(pTHX_ OP *o) {
    SV *code = indirect_detag(hint);
 
    if (hint) {
+    SV     *file;
+    line_t  line;
     dSP;
+
     onamesv = sv_mortalcopy(onamesv);
     mnamesv = sv_mortalcopy(mnamesv);
 
+#ifdef USE_ITHREADS
+    file = newSVpv(CopFILE(&PL_compiling), 0);
+#else
+    file = sv_mortalcopy(CopFILESV(&PL_compiling));
+#endif
+    line = CopLINE(&PL_compiling);
+
     ENTER;
     SAVETMPS;
 
     PUSHMARK(SP);
-    EXTEND(SP, 2);
+    EXTEND(SP, 4);
     PUSHs(onamesv);
     PUSHs(mnamesv);
+    PUSHs(file);
+    mPUSHu(line);
     PUTBACK;
 
     call_sv(code, G_VOID);