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
. "'";
}
else {
- $^H{charnames_name_aliases}{$name} = $value;
-
- if (warnings::enabled('deprecated')) {
if ($name =~ / ( .* \s ) ( \s* ) $ /x) {
- carp "Trailing white-space in a charnames alias definition is deprecated; marked by <-- HERE in '$1 <-- HERE " . $2 . "'";
+ push @errors, "charnames alias definitions may not contain "
+ . "trailing white-space; marked by <-- HERE in "
+ . "'$1 <-- HERE " . $2 . "'";
+ next;
}
# Use '+' instead of '*' in this regex, because any trailing
- # blanks have already been warned about.
+ # blanks have already been found
if ($name =~ / ( .*? \s{2} ) ( .+ ) /x) {
- carp "A sequence of multiple spaces in a charnames alias definition is deprecated; marked by <-- HERE in '$1 <-- HERE " . $2 . "'";
+ push @errors, "charnames alias definitions may not contain a "
+ . "sequence of multiple spaces; marked by <-- HERE "
+ . "in '$1 <-- HERE " . $2 . "'";
+ next;
+ }
+
+ $^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 . "'";
}
- }
}
}
}