This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
charnames: Fix scoping bugs
authorKarl Williamson <khw@khw-desktop.(none)>
Sun, 11 Jul 2010 17:25:25 +0000 (11:25 -0600)
committerKarl Williamson <khw@khw-desktop.(none)>
Tue, 13 Jul 2010 23:10:33 +0000 (17:10 -0600)
commit84374e300994574aae57659117b349a624cdc22c
treefd02a10d7068b03881ebc3818991aef14b38fac2
parent5ff2e4c00484f467453335cd2b906b7ce1e33a58
charnames: Fix scoping bugs

This was done by moving what could to %^H.  Because data structures in
%^H get stringified at runtime, new serialized entries for them had to
be created and then unserialized on each runtime call.  Also, because
%^H is read-only at runtime, some data structures couldn't be moved to
it.  Things were set up so that these contain only things invariant
under scoping, and looked at only when the same scoped options are in
effect as when they were created.  Further comments at declaration of
%full_names_cache.

I was well into this patch when it dawned on me that it was doing
unnecessary tests, so that
    if (! a) { conditionally set a }
    if (! a) {}

could be implemented more efficiently as

    if (! a) {
conditionally set a }
if (! a) {}
    }

so I changed it, which messes up leading indentation for the diffs.
lib/charnames.pm
lib/charnames.t
t/lib/charnames/alias