NAME

Unicode::Char - OO interface to charnames and others

SYNOPSIS

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";

DESCRIPTION

This module provides OO interface to Unicode characters.

$u->u()

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.

$u->n()

Returns a character whose Unicode Canonical Name is the argument.

$u->n('white smiling face'); 

But as $u->u(), you may prefer the handier version:

$u->white_smiling_face;

As you many have noticed, these names do not have to be all in caps. Just replace spaces with underscore.

$u->name()

Returns the Unicode Canonical Name of the character.;

my $name    = $u->name(chr(0x263A)); # WHITE SMILING FACE
$u->names()

Same as above but in list context.

my @names = $u->names("perl");  # ('LATIN SMALL LETTER P',
                                #  'LATIN SMALL LETTER E',
                                #  'LATIN SMALL LETTER R',
                                #  'LATIN SMALL LETTER L')

EXPORT

None.

SEE ALSO

perlunicode, perluniintro, charnames

AUTHOR

Dan Kogai, <dankogai@cpan.org>

COPYRIGHT AND LICENSE

Copyright (C) 2006-2022 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.