diff options
author | Karl Williamson <khw@cpan.org> | 2014-11-18 17:03:03 -0700 |
---|---|---|
committer | Karl Williamson <khw@cpan.org> | 2014-11-20 21:45:18 -0700 |
commit | 3e669301f0a6fa34269f0e1eaf1fbbd72cae498a (patch) | |
tree | beee9d02aa7b2dd05cdc5ecf701a7b0f392aba55 /embedvar.h | |
parent | ad2de1b2b22db677f46346aac18927b2032d7a68 (diff) | |
download | perl-3e669301f0a6fa34269f0e1eaf1fbbd72cae498a.tar.gz |
Make encoding pragma lexical in scope
The encoding pragma is deprecated, but in the meantime it causes spooky
action at a distance with other modules that it may be combined with.
In these modules, operations such as chr(), ord(), and utf8::upgrade()
will suddenly start doing the wrong thing.
The documentation for 'encoding' has said to call it after loading other
modules, but this may be impractical. This is especially bad with
anything that auto-loads at first use, like \N{} does now for charnames.
There is an issue with combining this with setting the variable
${^ENCODING} directly. The potential for conflicts has always been
there, and remains. This commit introduces a shadow hidden variable,
subservient to ${^ENCODING} (to preserve backwards compatibility) that
has lexical scope validity.
The pod for 'encoding' has been revamped to be more concise, clear, use
more idiomatic English, and to speak from a modern perspective.
Diffstat (limited to 'embedvar.h')
-rw-r--r-- | embedvar.h | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/embedvar.h b/embedvar.h index 60c897b494..2a3ebdc53e 100644 --- a/embedvar.h +++ b/embedvar.h @@ -179,6 +179,7 @@ #define PL_lastgotoprobe (vTHX->Ilastgotoprobe) #define PL_laststatval (vTHX->Ilaststatval) #define PL_laststype (vTHX->Ilaststype) +#define PL_lex_encoding (vTHX->Ilex_encoding) #define PL_localizing (vTHX->Ilocalizing) #define PL_localpatches (vTHX->Ilocalpatches) #define PL_lockhook (vTHX->Ilockhook) |