This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
perldelta for f31006c
[perl5.git] / lib / _charnames.pm
index 4806b8f..92286c2 100644 (file)
@@ -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
@@ -185,19 +186,30 @@ sub alias (@) # Set up a single alias
                         . "'";
         }
         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 . "'";
             }
-          }
         }
     }
   }