summaryrefslogtreecommitdiff
path: root/lib/_charnames.pm
diff options
context:
space:
mode:
authorKarl Williamson <khw@cpan.org>2014-04-26 11:27:52 -0600
committerKarl Williamson <khw@cpan.org>2014-05-30 10:24:26 -0600
commitdf758df2cf990debef5a719b684d8f2689a0bdcb (patch)
treeea1352d4465bff5db9d32d6fa3236698c24e6b37 /lib/_charnames.pm
parent7fc824585380f310eb2c75afd2cdb021c39dbfe9 (diff)
downloadperl-df758df2cf990debef5a719b684d8f2689a0bdcb.tar.gz
Deprecate NBSP in \N{...} names
This is currently allowed, but is non-graphic, and is indistinguishable from a regular space. I was the one who initially allowed it, and did so out of ignorance of the negative consequences of doing so. There is no other precedent for including it.
Diffstat (limited to 'lib/_charnames.pm')
-rw-r--r--lib/_charnames.pm8
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/_charnames.pm b/lib/_charnames.pm
index 4df3695cc2..92286c2067 100644
--- a/lib/_charnames.pm
+++ b/lib/_charnames.pm
@@ -144,6 +144,7 @@ sub carp
sub alias (@) # Set up a single alias
{
my @errors;
+ my $nbsp = chr utf8::unicode_to_native(0xA0);
my $alias = ref $_[0] ? $_[0] : { @_ };
foreach my $name (sort keys %$alias) { # Sort only because it helps having
@@ -202,6 +203,13 @@ sub alias (@) # Set up a single alias
}
$^H{charnames_name_aliases}{$name} = $value;
+ if (warnings::enabled('deprecated')
+ && $name =~ / ( .* $nbsp ) ( .* ) $ /x)
+ {
+ carp "NO-BREAK SPACE in a charnames alias definition is "
+ . "deprecated; marked by <-- HERE in '$1 <-- HERE "
+ . $2 . "'";
+ }
}
}
}