Add ${^UTF8LOCALE} to give perl space access to PL_utf8locale
Nicholas Clark [Tue, 4 Jan 2005 11:27:57 +0000 (11:27 +0000)]
p4raw-id: //depot/perl@23741

gv.c
mg.c

diff --git a/gv.c b/gv.c
index 413ce99..4b34bd4 100644 (file)
--- a/gv.c
+++ b/gv.c
@@ -926,9 +926,11 @@ Perl_gv_fetchpv(pTHX_ const char *nambeg, I32 add, I32 sv_type)
                if (strEQ(name2, "AINT"))
                    goto ro_magicalize;
                break;
-           case '\025':        /* $^UNICODE */
+           case '\025':        /* ${^UNICODE}, ${^UTF8LOCALE} */
                if (strEQ(name2, "NICODE")) 
                    goto ro_magicalize;
+               if (strEQ(name2, "TF8LOCALE")) 
+                   goto ro_magicalize;
                break;
            case '\027':        /* $^WARNING_BITS */
                if (strEQ(name2, "ARNING_BITS"))
@@ -1863,6 +1865,8 @@ Perl_is_gv_magical(pTHX_ char *name, STRLEN len, U32 flags)
        case '\025':    /* ${^UNICODE} */
            if (strEQ(name1, "NICODE"))
                goto yes;
+           if (strEQ(name1, "TF8LOCALE")) 
+               goto yes;
            break;
        case '\027':   /* ${^WARNING_BITS} */
            if (strEQ(name1, "ARNING_BITS"))
diff --git a/mg.c b/mg.c
index b5a9290..64d4d25 100644 (file)
--- a/mg.c
+++ b/mg.c
@@ -715,9 +715,11 @@ Perl_magic_get(pTHX_ SV *sv, MAGIC *mg)
                    ? (PL_taint_warn || PL_unsafe ? -1 : 1)
                    : 0);
         break;
-    case '\025':               /* $^UNICODE */
+    case '\025':               /* $^UNICODE, $^UTF8LOCALE */
         if (strEQ(mg->mg_ptr, "\025NICODE"))
            sv_setuv(sv, (UV) PL_unicode);
+        else if (strEQ(mg->mg_ptr, "\025TF8LOCALE"))
+           sv_setuv(sv, (UV) PL_utf8locale);
         break;
     case '\027':               /* ^W  & $^WARNING_BITS */
        if (*(mg->mg_ptr+1) == '\0')