diff options
-rw-r--r-- | lib/_charnames.pm | 11 | ||||
-rw-r--r-- | t/lib/charnames/alias | 8 |
2 files changed, 14 insertions, 5 deletions
diff --git a/lib/_charnames.pm b/lib/_charnames.pm index d29af30f8e..f333234688 100644 --- a/lib/_charnames.pm +++ b/lib/_charnames.pm @@ -742,20 +742,21 @@ sub viacode { && (! defined $H_ref || ! exists $H_ref->{charnames_stringified_inverse_ords}); - my %code_point_aliases = split ',', + my %code_point_aliases; + if (defined $H_ref->{charnames_stringified_inverse_ords}) { + %code_point_aliases = split ',', $H_ref->{charnames_stringified_inverse_ords}; - if (! exists $code_point_aliases{$hex}) { + return $code_point_aliases{$hex} if exists $code_point_aliases{$hex}; + } - # If there is an official alias, and no user-defined one, return that + # Here there is no user-defined alias, return any official one. return $return if defined $return; if (CORE::hex($hex) > 0x10FFFF) { carp "Unicode characters only allocated up to U+10FFFF (you asked for U+$hex)"; } return; - } - return $code_point_aliases{$hex}; } # _viacode 1; diff --git a/t/lib/charnames/alias b/t/lib/charnames/alias index fb1a914fda..75280be7b3 100644 --- a/t/lib/charnames/alias +++ b/t/lib/charnames/alias @@ -338,3 +338,11 @@ charnames::viacode(0x41); EXPECT OPTIONS regex $ +######## +# NAME no extraneous warning [perl #11560] +use warnings; +use charnames (); +print charnames::viacode(0x80), "\n"; +EXPECT +OPTIONS regex +PADDING CHARACTER |