diff options
author | Karl Williamson <khw@cpan.org> | 2014-04-26 11:27:52 -0600 |
---|---|---|
committer | Karl Williamson <khw@cpan.org> | 2014-05-30 10:24:26 -0600 |
commit | df758df2cf990debef5a719b684d8f2689a0bdcb (patch) | |
tree | ea1352d4465bff5db9d32d6fa3236698c24e6b37 /lib | |
parent | 7fc824585380f310eb2c75afd2cdb021c39dbfe9 (diff) | |
download | perl-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')
-rw-r--r-- | lib/_charnames.pm | 8 | ||||
-rw-r--r-- | lib/charnames.pm | 4 |
2 files changed, 11 insertions, 1 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 . "'"; + } } } } diff --git a/lib/charnames.pm b/lib/charnames.pm index d33b7877d2..6f5d51df32 100644 --- a/lib/charnames.pm +++ b/lib/charnames.pm @@ -280,7 +280,9 @@ Aliases must begin with a character that is alphabetic. After that, each may contain any combination of word (C<\w>) characters, SPACE (U+0020), HYPHEN-MINUS (U+002D), LEFT PARENTHESIS (U+0028), RIGHT PARENTHESIS (U+0029), and NO-BREAK SPACE (U+00A0). These last three should never have been allowed -in names, and are retained for backwards compatibility only; they may be +in names, and are retained for backwards compatibility only; NO-BREAK SPACE IS +currently deprecated and scheduled for removal in Perl v5.26; the other two +may also be deprecated and removed in future releases of Perl, so don't use them for new names. (More precisely, the first character of a name you specify must be something that matches all of C<\p{ID_Start}>, C<\p{Alphabetic}>, and |