This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
In installperl, record the state of options in %opts instead of lexicals.
[perl5.git] / pad.c
diff --git a/pad.c b/pad.c
index 549d3f5..15b2656 100644 (file)
--- a/pad.c
+++ b/pad.c
@@ -1714,13 +1714,21 @@ Perl_pad_tidy(pTHX_ padtidy_type type)
 
     ASSERT_CURPAD_ACTIVE("pad_tidy");
 
-    /* If this CV has had any 'eval-capable' ops planted in it
-     * (ie it contains eval '...', //ee, /$var/ or /(?{..})/), Then any
-     * anon prototypes in the chain of CVs should be marked as cloneable,
-     * so that for example the eval's CV in C<< sub { eval '$x' } >> gets
-     * the right CvOUTSIDE.
-     * If running with -d, *any* sub may potentially have an eval
-     * executed within it.
+    /* If this CV has had any 'eval-capable' ops planted in it:
+     * i.e. it contains any of:
+     *
+     *     * eval '...',
+     *     * //ee,
+     *     * use re 'eval'; /$var/
+     *     * /(?{..})/),
+     *
+     * Then any anon prototypes in the chain of CVs should be marked as
+     * cloneable, so that for example the eval's CV in
+     *
+     *    sub { eval '$x' }
+     *
+     * gets the right CvOUTSIDE.  If running with -d, *any* sub may
+     * potentially have an eval executed within it.
      */
 
     if (PL_cv_has_eval || PL_perldb) {
@@ -1737,7 +1745,7 @@ Perl_pad_tidy(pTHX_ padtidy_type type)
        }
     }
 
-    /* extend curpad to match namepad */
+    /* extend namepad to match curpad */
     if (AvFILLp(PL_comppad_name) < AvFILLp(PL_comppad))
        av_store(PL_comppad_name, AvFILLp(PL_comppad), NULL);
 
@@ -2142,8 +2150,11 @@ S_cv_clone(pTHX_ CV *proto, CV *cv, CV *outside)
     CvSTART(cv)                = CvSTART(proto);
     CvOUTSIDE_SEQ(cv) = CvOUTSIDE_SEQ(proto);
 
-    if (SvPOK(proto))
+    if (SvPOK(proto)) {
        sv_setpvn(MUTABLE_SV(cv), SvPVX_const(proto), SvCUR(proto));
+        if (SvUTF8(proto))
+           SvUTF8_on(MUTABLE_SV(cv));
+    }
     if (SvMAGIC(proto))
        mg_copy((SV *)proto, (SV *)cv, 0, 0);