summaryrefslogtreecommitdiff
path: root/lib/utf8_heavy.pl
diff options
context:
space:
mode:
authorKarl Williamson <public@khwilliamson.com>2011-11-22 09:18:28 -0700
committerKarl Williamson <public@khwilliamson.com>2012-01-13 09:58:33 -0700
commit4a7e937e5e38b45d73f74bc6acde04dfb15ad1aa (patch)
tree9c5cd9dd9c801a534e3d87b835cce54e302494c6 /lib/utf8_heavy.pl
parent90412e3e3b234b8972b49e7b15bf4d94b2d1540a (diff)
downloadperl-4a7e937e5e38b45d73f74bc6acde04dfb15ad1aa.tar.gz
utf8_heavy.pl: Add inversion status to cache key
Contrary to what the debug statement said, what is being returned is a swash, and that swash is different from one that comes from the same file but differs in inversion, and so changing the INVERT_IT element messes things up for any existing one. Heretofore it hasn't mattered because the swash returned is always a copy, and so it actually hasn't created any problems. But future commits will stop the copying, so this would create problems then. The file will now have to be re-'do'ne to get an inverted list from it.
Diffstat (limited to 'lib/utf8_heavy.pl')
-rw-r--r--lib/utf8_heavy.pl18
1 files changed, 10 insertions, 8 deletions
diff --git a/lib/utf8_heavy.pl b/lib/utf8_heavy.pl
index 3d78d800d4..675a8d1d47 100644
--- a/lib/utf8_heavy.pl
+++ b/lib/utf8_heavy.pl
@@ -405,8 +405,9 @@ sub _loose_name ($) {
# Add the constant and go fetch it in.
if (defined $file) {
- # A beginning ! means to invert
- $invert_it = $file =~ s/^!//;
+ # A beginning ! means to invert. The 0+ makes sure is
+ # numeric
+ $invert_it = 0 + $file =~ s/^!//;
if ($utf8::why_deprecated{$file}) {
warnings::warnif('deprecated', "Use of '$type' in \\p{} or \\P{} is deprecated because: $utf8::why_deprecated{$file};");
@@ -478,7 +479,8 @@ sub _loose_name ($) {
# get it.
$minbits = 1;
- $invert_it = $file =~ s/^!//;
+ # The 0+ makes sure is numeric
+ $invert_it = 0 + $file =~ s/^!//;
$file = "$unicore_dir/lib/$file.pl";
last GETFILE;
}
@@ -501,13 +503,13 @@ sub _loose_name ($) {
## (exception: user-defined properties and mappings), so we
## have a filename, so now we load it if we haven't already.
## If we have, return the cached results. The cache key is the
- ## class and file to load.
+ ## class and file to load, and whether the results need to be
+ ## inverted.
##
- my $found = $Cache{$class, $file};
+ my $found = $Cache{$class, $file, $invert_it};
if ($found and ref($found) eq $class) {
- print STDERR __LINE__, ": Returning cached '$file' for \\p{$type}; invert_it=$invert_it\n" if DEBUG;
+ print STDERR __LINE__, ": Returning cached swash for '$class,$file,$invert_it' for \\p{$type}\n" if DEBUG;
pop @recursed if @recursed;
- $found->{'INVERT_IT'} = $invert_it;
return $found;
}
@@ -643,7 +645,7 @@ sub _loose_name ($) {
} => $class;
if ($file) {
- $Cache{$class, $file} = $SWASH;
+ $Cache{$class, $file, $invert_it} = $SWASH;
if ($type
&& exists $utf8::SwashInfo{$type}
&& exists $utf8::SwashInfo{$type}{'specials_name'})