This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Document upgrading a module in cpan/
[perl5.git] / cop.h
diff --git a/cop.h b/cop.h
index 83c8698..c2f7d34 100644 (file)
--- a/cop.h
+++ b/cop.h
@@ -138,7 +138,7 @@ typedef struct jmpenv JMPENV;
            PerlProc_longjmp(PL_top_env->je_buf, (v));          \
        if ((v) == 2)                                           \
            PerlProc_exit(STATUS_EXIT);                         \
-       PerlIO_printf(PerlIO_stderr(), "panic: top_env\n");     \
+       PerlIO_printf(PerlIO_stderr(), "panic: top_env, v=%d\n", (int)v); \
        PerlProc_exit(1);                                       \
     } STMT_END
 
@@ -389,6 +389,7 @@ struct cop {
 #ifdef USE_ITHREADS
     char *     cop_stashpv;    /* package line was compiled in */
     char *     cop_file;       /* file name the following line # is from */
+    U32         cop_stashflags; /* currently only SVf_UTF8 */
 #else
     HV *       cop_stash;      /* package line was compiled in */
     GV *       cop_filegv;     /* file the following line # is from */
@@ -433,9 +434,20 @@ struct cop {
 #    define CopSTASHPV_set(c,pv)       ((c)->cop_stashpv = savesharedpv(pv))
 #  endif
 
-#  define CopSTASH(c)          (CopSTASHPV(c) \
-                                ? gv_stashpv(CopSTASHPV(c),GV_ADD) : NULL)
-#  define CopSTASH_set(c,hv)   CopSTASHPV_set(c, (hv) ? HvNAME_get(hv) : NULL)
+#  define CopSTASH_flags(c)            ((c)->cop_stashflags)
+#  define CopSTASH_flags_set(c,flags)  ((c)->cop_stashflags = flags)
+
+#  define CopSTASH(c)          (CopSTASHPV(c)                                 \
+                                ? gv_stashpv(CopSTASHPV(c),                   \
+                                            GV_ADD|(CopSTASH_flags(c)          \
+                                                    ? CopSTASH_flags(c): 0 )) \
+                                 : NULL)
+#  define CopSTASH_set(c,hv)   (CopSTASHPV_set(c, (hv) ? HvNAME_get(hv) : NULL), \
+                                CopSTASH_flags_set(c,                            \
+                                            ((hv) && HvNAME_HEK(hv) &&              \
+                                                     HvNAMEUTF8(hv))                \
+                                                ? SVf_UTF8                          \
+                                                : 0))
 #  define CopSTASH_eq(c,hv)    ((hv) && stashpv_hvname_match(c,hv))
 #  ifdef NETWARE
 #    define CopSTASH_free(c) SAVECOPSTASH_FREE(c)