Yesterday we briefly discussed on IRC an issue I found with `use
charnames`. If you want to avoid being excessively wordy like with
`\N{HEBREW LETTER ALEF}` you can ask charnames.pm for some nice short
aliases. For example:
use charnames qw(hebrew);
say "\N{alef}";
Hebrew isn't special of course, you can do this for all kinds of
scripts. You can even do it for multiple scripts at the same time:
use charnames qw(greek runic);
say "\N{gamma}";
say "\N{yr}";
But there's a problem. Several scripts have letters with the same name.
Hebrew and Arabic, for example, both have a letter 'alef', so what
happens here?
use charnames qw(arabic hebrew);
say "\N{alef}";
As it happens, you seem to always get HEBREW LETTER ALEF, because
Hebrew's codepoints come before Arabic's. But I think it would be a good
idea to at least warn the user of the potential for confusion like this,
so I've created a pull request:
https://github.com/Perl/perl5/pull/19369
It's only a preliminary draft and definitely needs work, in particular
the text I've put in the warning itself needs improvement.
--
David Cantrell
charnames`. If you want to avoid being excessively wordy like with
`\N{HEBREW LETTER ALEF}` you can ask charnames.pm for some nice short
aliases. For example:
use charnames qw(hebrew);
say "\N{alef}";
Hebrew isn't special of course, you can do this for all kinds of
scripts. You can even do it for multiple scripts at the same time:
use charnames qw(greek runic);
say "\N{gamma}";
say "\N{yr}";
But there's a problem. Several scripts have letters with the same name.
Hebrew and Arabic, for example, both have a letter 'alef', so what
happens here?
use charnames qw(arabic hebrew);
say "\N{alef}";
As it happens, you seem to always get HEBREW LETTER ALEF, because
Hebrew's codepoints come before Arabic's. But I think it would be a good
idea to at least warn the user of the potential for confusion like this,
so I've created a pull request:
https://github.com/Perl/perl5/pull/19369
It's only a preliminary draft and definitely needs work, in particular
the text I've put in the warning itself needs improvement.
--
David Cantrell