Unicode::Char - OO interface to charnames and others
use Unicode::Char; my $u = Unicode::Char->new(); # prints "KOGAI Dan" in Kanji print $u->u5c0f, $u->u98fc, $u->u5f3e, "\n"; # smiley here print $u->white_smiling_face, $u->black_smiling_face, "\n";
This module provides OO interface to Unicode characters.
Returns a character whose Unicode Number is the argument.
$u->u('5c0f'); # "small" in Kanji
But the following is handier.
$u->u5c0f; # same thing but as a method
These methods are generatated on demand.
Returns a character whose Unicode Canonical Name is the argument.
$u->n('white smiling face');
$u->u(), you may prefer the handier version:
As you many have noticed, these names do not have to be all in caps. Just replace spaces with underscore.
Returns the Unicode Canonical Name of the character.;
my $name = $u->name(chr(0x263A)); # WHITE SMILING FACE
Same as above but in list context.
my (@names) = $u->name("perl"); # ('LATIN SMALL LETTER P', # 'LATIN SMALL LETTER E', # 'LATIN SMALL LETTER R', # 'LATIN SMALL LETTER L')
Dan Kogai, <firstname.lastname@example.org<gt>
COPYRIGHT AND LICENSE
Copyright (C) 2006 by Dan Kogai
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.8 or, at your option, any later version of Perl 5 you may have available.