diff options
author | Karl Williamson <public@khwilliamson.com> | 2012-03-05 19:33:50 -0700 |
---|---|---|
committer | Ricardo Signes <rjbs@cpan.org> | 2012-03-23 10:10:28 -0400 |
commit | 424313d48c16a7a9ce5a6341b6f65914fbddf259 (patch) | |
tree | 0d195f877aad59a2063014330275e900a13362bd /lib/_charnames.pm | |
parent | 7476a79c8db21237e6b6bcf579243fdfc880f8b9 (diff) | |
download | perl-424313d48c16a7a9ce5a6341b6f65914fbddf259.tar.gz |
PATCH: [perl #11560] extraneous msg in viacode
This refactors to test for the hash element being defined before
attempting to use it.
Diffstat (limited to 'lib/_charnames.pm')
-rw-r--r-- | lib/_charnames.pm | 11 |
1 files changed, 6 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; |