This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Make encoding pragma lexical in scope
authorKarl Williamson <khw@cpan.org>
Wed, 19 Nov 2014 00:03:03 +0000 (17:03 -0700)
committerKarl Williamson <khw@cpan.org>
Fri, 21 Nov 2014 04:45:18 +0000 (21:45 -0700)
commit3e669301f0a6fa34269f0e1eaf1fbbd72cae498a
treebeee9d02aa7b2dd05cdc5ecf701a7b0f392aba55
parentad2de1b2b22db677f46346aac18927b2032d7a68
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.
Porting/Maintainers.pl
cpan/Encode/encoding.pm
embedvar.h
gv.c
intrpvar.h
mg.c
perl.h
pod/perldelta.pod
pp_ctl.c
sv.c
t/porting/customized.dat