config root man

Current Path : /usr/opt/perl530/man/man3/

FreeBSD hs32.drive.ne.jp 9.1-RELEASE FreeBSD 9.1-RELEASE #1: Wed Jan 14 12:18:08 JST 2015 root@hs32.drive.ne.jp:/sys/amd64/compile/hs32 amd64
Upload File :
Current File : //usr/opt/perl530/man/man3/charnames.3

.\" Automatically generated by Pod::Man 4.11 (Pod::Simple 3.35)
.\"
.\" Standard preamble:
.\" ========================================================================
.de Sp \" Vertical space (when we can't use .PP)
.if t .sp .5v
.if n .sp
..
.de Vb \" Begin verbatim text
.ft CW
.nf
.ne \\$1
..
.de Ve \" End verbatim text
.ft R
.fi
..
.\" Set up some character translations and predefined strings.  \*(-- will
.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
.\" double quote, and \*(R" will give a right double quote.  \*(C+ will
.\" give a nicer C++.  Capital omega is used to do unbreakable dashes and
.\" therefore won't be available.  \*(C` and \*(C' expand to `' in nroff,
.\" nothing in troff, for use with C<>.
.tr \(*W-
.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
.ie n \{\
.    ds -- \(*W-
.    ds PI pi
.    if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
.    if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\"  diablo 12 pitch
.    ds L" ""
.    ds R" ""
.    ds C` ""
.    ds C' ""
'br\}
.el\{\
.    ds -- \|\(em\|
.    ds PI \(*p
.    ds L" ``
.    ds R" ''
.    ds C`
.    ds C'
'br\}
.\"
.\" Escape single quotes in literal strings from groff's Unicode transform.
.ie \n(.g .ds Aq \(aq
.el       .ds Aq '
.\"
.\" If the F register is >0, we'll generate index entries on stderr for
.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
.\" entries marked with X<> in POD.  Of course, you'll have to process the
.\" output yourself in some meaningful fashion.
.\"
.\" Avoid warning from groff about undefined register 'F'.
.de IX
..
.nr rF 0
.if \n(.g .if rF .nr rF 1
.if (\n(rF:(\n(.g==0)) \{\
.    if \nF \{\
.        de IX
.        tm Index:\\$1\t\\n%\t"\\$2"
..
.        if !\nF==2 \{\
.            nr % 0
.            nr F 2
.        \}
.    \}
.\}
.rr rF
.\"
.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
.\" Fear.  Run.  Save yourself.  No user-serviceable parts.
.    \" fudge factors for nroff and troff
.if n \{\
.    ds #H 0
.    ds #V .8m
.    ds #F .3m
.    ds #[ \f1
.    ds #] \fP
.\}
.if t \{\
.    ds #H ((1u-(\\\\n(.fu%2u))*.13m)
.    ds #V .6m
.    ds #F 0
.    ds #[ \&
.    ds #] \&
.\}
.    \" simple accents for nroff and troff
.if n \{\
.    ds ' \&
.    ds ` \&
.    ds ^ \&
.    ds , \&
.    ds ~ ~
.    ds /
.\}
.if t \{\
.    ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
.    ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
.    ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
.    ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
.    ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
.    ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
.\}
.    \" troff and (daisy-wheel) nroff accents
.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
.ds ae a\h'-(\w'a'u*4/10)'e
.ds Ae A\h'-(\w'A'u*4/10)'E
.    \" corrections for vroff
.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
.    \" for low resolution devices (crt and lpr)
.if \n(.H>23 .if \n(.V>19 \
\{\
.    ds : e
.    ds 8 ss
.    ds o a
.    ds d- d\h'-1'\(ga
.    ds D- D\h'-1'\(hy
.    ds th \o'bp'
.    ds Th \o'LP'
.    ds ae ae
.    ds Ae AE
.\}
.rm #[ #] #H #V #F C
.\" ========================================================================
.\"
.IX Title "charnames 3"
.TH charnames 3 "2019-10-24" "perl v5.30.2" "Perl Programmers Reference Guide"
.\" For nroff, turn off justification.  Always turn off hyphenation; it makes
.\" way too many mistakes in technical documents.
.if n .ad l
.nh
.SH "NAME"
charnames \- access to Unicode character names and named character sequences; also define character names
.SH "SYNOPSIS"
.IX Header "SYNOPSIS"
.Vb 4
\& use charnames \*(Aq:full\*(Aq;
\& print "\eN{GREEK SMALL LETTER SIGMA} is called sigma.\en";
\& print "\eN{LATIN CAPITAL LETTER E WITH VERTICAL LINE BELOW}",
\&       " is an officially named sequence of two Unicode characters\en";
\&
\& use charnames \*(Aq:loose\*(Aq;
\& print "\eN{Greek small\-letter  sigma}",
\&        "can be used to ignore case, underscores, most blanks,"
\&        "and when you aren\*(Aqt sure if the official name has hyphens\en";
\&
\& use charnames \*(Aq:short\*(Aq;
\& print "\eN{greek:Sigma} is an upper\-case sigma.\en";
\&
\& use charnames qw(cyrillic greek);
\& print "\eN{sigma} is Greek sigma, and \eN{be} is Cyrillic b.\en";
\&
\& use utf8;
\& use charnames ":full", ":alias" => {
\&   e_ACUTE => "LATIN SMALL LETTER E WITH ACUTE",
\&   mychar => 0xE8000,  # Private use area
\&   "XXXXXXX" => "BICYCLIST"
\& };
\& print "\eN{e_ACUTE} is a small letter e with an acute.\en";
\& print "\eN{mychar} allows me to name private use characters.\en";
\& print "And I can create synonyms in other languages,",
\&       " such as \eN{XXXXXXX} for "BICYCLIST (U+1F6B4)\en";
\&
\& use charnames ();
\& print charnames::viacode(0x1234); # prints "ETHIOPIC SYLLABLE SEE"
\& printf "%04X", charnames::vianame("GOTHIC LETTER AHSA"); # prints
\&                                                          # "10330"
\& print charnames::vianame("LATIN CAPITAL LETTER A"); # prints 65 on
\&                                                     # ASCII platforms;
\&                                                     # 193 on EBCDIC
\& print charnames::string_vianame("LATIN CAPITAL LETTER A"); # prints "A"
.Ve
.SH "DESCRIPTION"
.IX Header "DESCRIPTION"
Pragma \f(CW\*(C`use charnames\*(C'\fR is used to gain access to the names of the
Unicode characters and named character sequences, and to allow you to define
your own character and character sequence names.
.PP
All forms of the pragma enable use of the following 3 functions:
.IP "\(bu" 4
"charnames::string_vianame(\fIname\fR)" for run-time lookup of a
either a character name or a named character sequence, returning its string
representation
.IP "\(bu" 4
"charnames::vianame(\fIname\fR)" for run-time lookup of a
character name (but not a named character sequence) to get its ordinal value
(code point)
.IP "\(bu" 4
"charnames::viacode(\fIcode\fR)" for run-time lookup of a code point to get its
Unicode name.
.PP
Starting in Perl v5.16, any occurrence of \f(CW\*(C`\eN{\f(CICHARNAME\f(CW}\*(C'\fR sequences
in a double-quotish string automatically loads this module with arguments
\&\f(CW\*(C`:full\*(C'\fR and \f(CW\*(C`:short\*(C'\fR (described below) if it hasn't already been loaded with
different arguments, in order to compile the named Unicode character into
position in the string.  Prior to v5.16, an explicit \f(CW\*(C`use\ charnames\*(C'\fR was
required to enable this usage.  (However, prior to v5.16, the form \f(CW"use\ charnames\ ();"\fR did not enable \f(CW\*(C`\eN{\f(CICHARNAME\f(CW}\*(C'\fR.)
.PP
Note that \f(CW\*(C`\eN{U+\f(CI...\f(CW}\*(C'\fR, where the \fI...\fR is a hexadecimal number,
also inserts a character into a string.
The character it inserts is the one whose Unicode code point
(ordinal value) is equal to the number.  For example, \f(CW"\eN{U+263a}"\fR is
the Unicode (white background, black foreground) smiley face
equivalent to \f(CW"\eN{WHITE SMILING FACE}"\fR.
Also note, \f(CW\*(C`\eN{\f(CI...\f(CW}\*(C'\fR can mean a regex quantifier instead of a character
name, when the \fI...\fR is a number (or comma separated pair of numbers
(see \*(L"\s-1QUANTIFIERS\*(R"\s0 in perlreref), and is not related to this pragma.
.PP
The \f(CW\*(C`charnames\*(C'\fR pragma supports arguments \f(CW\*(C`:full\*(C'\fR, \f(CW\*(C`:loose\*(C'\fR, \f(CW\*(C`:short\*(C'\fR,
script names and customized aliases.
.PP
If \f(CW\*(C`:full\*(C'\fR is present, for expansion of
\&\f(CW\*(C`\eN{\f(CICHARNAME\f(CW}\*(C'\fR, the string \fI\s-1CHARNAME\s0\fR is first looked up in the list of
standard Unicode character names.
.PP
\&\f(CW\*(C`:loose\*(C'\fR is a variant of \f(CW\*(C`:full\*(C'\fR which allows \fI\s-1CHARNAME\s0\fR to be less
precisely specified.  Details are in \*(L"\s-1LOOSE MATCHES\*(R"\s0.
.PP
If \f(CW\*(C`:short\*(C'\fR is present, and
\&\fI\s-1CHARNAME\s0\fR has the form \f(CW\*(C`\f(CISCRIPT\f(CW:\f(CICNAME\f(CW\*(C'\fR, then \fI\s-1CNAME\s0\fR is looked up
as a letter in script \fI\s-1SCRIPT\s0\fR, as described in the next paragraph.
Or, if \f(CW\*(C`use charnames\*(C'\fR is used
with script name arguments, then for \f(CW\*(C`\eN{\f(CICHARNAME\f(CW}\*(C'\fR the name
\&\fI\s-1CHARNAME\s0\fR is looked up as a letter in the given scripts (in the
specified order). Customized aliases can override these, and are explained in
\&\*(L"\s-1CUSTOM ALIASES\*(R"\s0.
.PP
For lookup of \fI\s-1CHARNAME\s0\fR inside a given script \fI\s-1SCRIPTNAME\s0\fR,
this pragma looks in the table of standard Unicode names for the names
.PP
.Vb 3
\&  SCRIPTNAME CAPITAL LETTER CHARNAME
\&  SCRIPTNAME SMALL LETTER CHARNAME
\&  SCRIPTNAME LETTER CHARNAME
.Ve
.PP
If \fI\s-1CHARNAME\s0\fR is all lowercase,
then the \f(CW\*(C`CAPITAL\*(C'\fR variant is ignored, otherwise the \f(CW\*(C`SMALL\*(C'\fR variant
is ignored, and both \fI\s-1CHARNAME\s0\fR and \fI\s-1SCRIPTNAME\s0\fR are converted to all
uppercase for look-up.  Other than that, both of them follow loose rules if \f(CW\*(C`:loose\*(C'\fR is also specified; strict otherwise.
.PP
Note that \f(CW\*(C`\eN{...}\*(C'\fR is compile-time; it's a special form of string
constant used inside double-quotish strings; this means that you cannot
use variables inside the \f(CW\*(C`\eN{...}\*(C'\fR.  If you want similar run-time
functionality, use
\&\fBcharnames::string_vianame()\fR.
.PP
Note, starting in Perl 5.18, the name \f(CW\*(C`BELL\*(C'\fR refers to the Unicode character
U+1F514, instead of the traditional U+0007.  For the latter, use \f(CW\*(C`ALERT\*(C'\fR
or \f(CW\*(C`BEL\*(C'\fR.
.PP
It is a syntax error to use \f(CW\*(C`\eN{NAME}\*(C'\fR where \f(CW\*(C`NAME\*(C'\fR is unknown.
.PP
For \f(CW\*(C`\eN{NAME}\*(C'\fR, it is a fatal error if \f(CW\*(C`use bytes\*(C'\fR is in effect and the
input name is that of a character that won't fit into a byte (i.e., whose
ordinal is above 255).
.PP
Otherwise, any string that includes a \f(CW\*(C`\eN{\f(CIcharname\f(CW}\*(C'\fR or
\&\f(CW\*(C`\eN{U+\f(CIcode\ point\f(CW}\*(C'\fR will automatically have Unicode rules (see
\&\*(L"Byte and Character Semantics\*(R" in perlunicode).
.SH "LOOSE MATCHES"
.IX Header "LOOSE MATCHES"
By specifying \f(CW\*(C`:loose\*(C'\fR, Unicode's loose character name
matching <http://www.unicode.org/reports/tr44#Matching_Rules> rules are
selected instead of the strict exact match used otherwise.
That means that \fI\s-1CHARNAME\s0\fR doesn't have to be so precisely specified.
Upper/lower case doesn't matter (except with scripts as mentioned above), nor
do any underscores, and the only hyphens that matter are those at the
beginning or end of a word in the name (with one exception:  the hyphen in
U+1180 \f(CW\*(C`HANGUL JUNGSEONG O\-E\*(C'\fR does matter).
Also, blanks not adjacent to hyphens don't matter.
The official Unicode names are quite variable as to where they use hyphens
versus spaces to separate word-like units, and this option allows you to not
have to care as much.
The reason non-medial hyphens matter is because of cases like
U+0F60 \f(CW\*(C`TIBETAN LETTER \-A\*(C'\fR versus U+0F68 \f(CW\*(C`TIBETAN LETTER A\*(C'\fR.
The hyphen here is significant, as is the space before it, and so both must be
included.
.PP
\&\f(CW\*(C`:loose\*(C'\fR slows down look-ups by a factor of 2 to 3 versus
\&\f(CW\*(C`:full\*(C'\fR, but the trade-off may be worth it to you.  Each individual look-up
takes very little time, and the results are cached, so the speed difference
would become a factor only in programs that do look-ups of many different
spellings, and probably only when those look-ups are through \f(CW\*(C`vianame()\*(C'\fR and
\&\f(CW\*(C`string_vianame()\*(C'\fR, since \f(CW\*(C`\eN{...}\*(C'\fR look-ups are done at compile time.
.SH "ALIASES"
.IX Header "ALIASES"
Starting in Unicode 6.1 and Perl v5.16, Unicode defines many abbreviations and
names that were formerly Perl extensions, and some additional ones that Perl
did not previously accept.  The list is getting too long to reproduce here,
but you can get the complete list from the Unicode web site:
<http://www.unicode.org/Public/UNIDATA/NameAliases.txt>.
.PP
Earlier versions of Perl accepted almost all the 6.1 names.  These were most
extensively documented in the v5.14 version of this pod:
<http://perldoc.perl.org/5.14.0/charnames.html#ALIASES>.
.SH "CUSTOM ALIASES"
.IX Header "CUSTOM ALIASES"
You can add customized aliases to standard (\f(CW\*(C`:full\*(C'\fR) Unicode naming
conventions.  The aliases override any standard definitions, so, if
you're twisted enough, you can change \f(CW"\eN{LATIN CAPITAL LETTER A}"\fR to
mean \f(CW"B"\fR, etc.
.PP
Aliases must begin with a character that is alphabetic.  After that, each may
contain any combination of word (\f(CW\*(C`\ew\*(C'\fR) characters, \s-1SPACE\s0 (U+0020),
HYPHEN-MINUS (U+002D), \s-1LEFT PARENTHESIS\s0 (U+0028), and \s-1RIGHT PARENTHESIS\s0
(U+0029).  These last two should never have been allowed
in names, and are retained for backwards compatibility only, and may be
deprecated and removed in future releases of Perl, so don't use them for new
names.  (More precisely, the first character of a name you specify must be
something that matches all of \f(CW\*(C`\ep{ID_Start}\*(C'\fR, \f(CW\*(C`\ep{Alphabetic}\*(C'\fR, and
\&\f(CW\*(C`\ep{Gc=Letter}\*(C'\fR.  This makes sure it is what any reasonable person would view
as an alphabetic character.  And, the continuation characters that match \f(CW\*(C`\ew\*(C'\fR
must also match \f(CW\*(C`\ep{ID_Continue}\*(C'\fR.)  Starting with Perl v5.18, any Unicode
characters meeting the above criteria may be used; prior to that only
Latin1\-range characters were acceptable.
.PP
An alias can map to either an official Unicode character name (not a loose
matched name) or to a
numeric code point (ordinal).  The latter is useful for assigning names
to code points in Unicode private use areas such as U+E800 through
U+F8FF.
A numeric code point must be a non-negative integer, or a string beginning
with \f(CW"U+"\fR or \f(CW"0x"\fR with the remainder considered to be a
hexadecimal integer.  A literal numeric constant must be unsigned; it
will be interpreted as hex if it has a leading zero or contains
non-decimal hex digits; otherwise it will be interpreted as decimal.
If it begins with \f(CW"U+"\fR, it is interpreted as the Unicode code point;
otherwise it is interpreted as native.  (Only code points below 256 can
differ between Unicode and native.)  Thus \f(CW\*(C`U+41\*(C'\fR is always the Latin letter
\&\*(L"A\*(R"; but \f(CW0x41\fR can be \*(L"NO-BREAK \s-1SPACE\*(R"\s0 on \s-1EBCDIC\s0 platforms.
.PP
Aliases are added either by the use of anonymous hashes:
.PP
.Vb 5
\&    use charnames ":alias" => {
\&        e_ACUTE => "LATIN SMALL LETTER E WITH ACUTE",
\&        mychar1 => 0xE8000,
\&        };
\&    my $str = "\eN{e_ACUTE}";
.Ve
.PP
or by using a file containing aliases:
.PP
.Vb 1
\&    use charnames ":alias" => "pro";
.Ve
.PP
This will try to read \f(CW"unicore/pro_alias.pl"\fR from the \f(CW@INC\fR path. This
file should return a list in plain perl:
.PP
.Vb 10
\&    (
\&    A_GRAVE         => "LATIN CAPITAL LETTER A WITH GRAVE",
\&    A_CIRCUM        => "LATIN CAPITAL LETTER A WITH CIRCUMFLEX",
\&    A_DIAERES       => "LATIN CAPITAL LETTER A WITH DIAERESIS",
\&    A_TILDE         => "LATIN CAPITAL LETTER A WITH TILDE",
\&    A_BREVE         => "LATIN CAPITAL LETTER A WITH BREVE",
\&    A_RING          => "LATIN CAPITAL LETTER A WITH RING ABOVE",
\&    A_MACRON        => "LATIN CAPITAL LETTER A WITH MACRON",
\&    mychar2         => "U+E8001",
\&    );
.Ve
.PP
Both these methods insert \f(CW":full"\fR automatically as the first argument (if no
other argument is given), and you can give the \f(CW":full"\fR explicitly as
well, like
.PP
.Vb 1
\&    use charnames ":full", ":alias" => "pro";
.Ve
.PP
\&\f(CW":loose"\fR has no effect with these.  Input names must match exactly, using
\&\f(CW":full"\fR rules.
.PP
Also, both these methods currently allow only single characters to be named.
To name a sequence of characters, use a
custom translator (described below).
.SH "charnames::string_vianame(\fIname\fP)"
.IX Header "charnames::string_vianame(name)"
This is a runtime equivalent to \f(CW\*(C`\eN{...}\*(C'\fR.  \fIname\fR can be any expression
that evaluates to a name accepted by \f(CW\*(C`\eN{...}\*(C'\fR under the \f(CW\*(C`:full\*(C'\fR
option to \f(CW\*(C`charnames\*(C'\fR.  In addition, any other options for the
controlling \f(CW"use charnames"\fR in the same scope apply, like \f(CW\*(C`:loose\*(C'\fR or any
script list, \f(CW\*(C`:short\*(C'\fR option, or custom aliases you may have defined.
.PP
The only differences are due to the fact that \f(CW\*(C`string_vianame\*(C'\fR is run-time
and \f(CW\*(C`\eN{}\*(C'\fR is compile time.  You can't interpolate inside a \f(CW\*(C`\eN{}\*(C'\fR, (so
\&\f(CW\*(C`\eN{$variable}\*(C'\fR doesn't work); and if the input name is unknown,
\&\f(CW\*(C`string_vianame\*(C'\fR returns \f(CW\*(C`undef\*(C'\fR instead of it being a syntax error.
.SH "charnames::vianame(\fIname\fP)"
.IX Header "charnames::vianame(name)"
This is similar to \f(CW\*(C`string_vianame\*(C'\fR.  The main difference is that under most
circumstances, \f(CW\*(C`vianame\*(C'\fR returns an ordinal code
point, whereas \f(CW\*(C`string_vianame\*(C'\fR returns a string.  For example,
.PP
.Vb 1
\&   printf "U+%04X", charnames::vianame("FOUR TEARDROP\-SPOKED ASTERISK");
.Ve
.PP
prints \*(L"U+2722\*(R".
.PP
This leads to the other two differences.  Since a single code point is
returned, the function can't handle named character sequences, as these are
composed of multiple characters (it returns \f(CW\*(C`undef\*(C'\fR for these.  And, the code
point can be that of any
character, even ones that aren't legal under the \f(CW\*(C`use\ bytes\*(C'\fR pragma,
.PP
See \*(L"\s-1BUGS\*(R"\s0 for the circumstances in which the behavior differs
from  that described above.
.SH "charnames::viacode(\fIcode\fP)"
.IX Header "charnames::viacode(code)"
Returns the full name of the character indicated by the numeric code.
For example,
.PP
.Vb 1
\&    print charnames::viacode(0x2722);
.Ve
.PP
prints \*(L"\s-1FOUR\s0 TEARDROP-SPOKED \s-1ASTERISK\*(R".\s0
.PP
The name returned is the \*(L"best\*(R" (defined below) official name or alias
for the code point, if
available; otherwise your custom alias for it, if defined; otherwise \f(CW\*(C`undef\*(C'\fR.
This means that your alias will only be returned for code points that don't
have an official Unicode name (nor alias) such as private use code points.
.PP
If you define more than one name for the code point, it is indeterminate
which one will be returned.
.PP
As mentioned, the function returns \f(CW\*(C`undef\*(C'\fR if no name is known for the code
point.  In Unicode the proper name for these is the empty string, which
\&\f(CW\*(C`undef\*(C'\fR stringifies to.  (If you ask for a code point past the legal
Unicode maximum of U+10FFFF that you haven't assigned an alias to, you
get \f(CW\*(C`undef\*(C'\fR plus a warning.)
.PP
The input number must be a non-negative integer, or a string beginning
with \f(CW"U+"\fR or \f(CW"0x"\fR with the remainder considered to be a
hexadecimal integer.  A literal numeric constant must be unsigned; it
will be interpreted as hex if it has a leading zero or contains
non-decimal hex digits; otherwise it will be interpreted as decimal.
If it begins with \f(CW"U+"\fR, it is interpreted as the Unicode code point;
otherwise it is interpreted as native.  (Only code points below 256 can
differ between Unicode and native.)  Thus \f(CW\*(C`U+41\*(C'\fR is always the Latin letter
\&\*(L"A\*(R"; but \f(CW0x41\fR can be \*(L"NO-BREAK \s-1SPACE\*(R"\s0 on \s-1EBCDIC\s0 platforms.
.PP
As mentioned above under \*(L"\s-1ALIASES\*(R"\s0, Unicode 6.1 defines extra names
(synonyms or aliases) for some code points, most of which were already
available as Perl extensions.  All these are accepted by \f(CW\*(C`\eN{...}\*(C'\fR and the
other functions in this module, but \f(CW\*(C`viacode\*(C'\fR has to choose which one
name to return for a given input code point, so it returns the \*(L"best\*(R" name.
To understand how this works, it is helpful to know more about the Unicode
name properties.  All code points actually have only a single name, which
(starting in Unicode 2.0) can never change once a character has been assigned
to the code point.  But mistakes have been made in assigning names, for
example sometimes a clerical error was made during the publishing of the
Standard which caused words to be misspelled, and there was no way to correct
those.  The Name_Alias property was eventually created to handle these
situations.  If a name was wrong, a corrected synonym would be published for
it, using Name_Alias.  \f(CW\*(C`viacode\*(C'\fR will return that corrected synonym as the
\&\*(L"best\*(R" name for a code point.  (It is even possible, though it hasn't happened
yet, that the correction itself will need to be corrected, and so another
Name_Alias can be created for that code point; \f(CW\*(C`viacode\*(C'\fR will return the
most recent correction.)
.PP
The Unicode name for each of the control characters (such as \s-1LINE FEED\s0) is the
empty string.  However almost all had names assigned by other standards, such
as the \s-1ASCII\s0 Standard, or were in common use.  \f(CW\*(C`viacode\*(C'\fR returns these names
as the \*(L"best\*(R" ones available.  Unicode 6.1 has created Name_Aliases for each
of them, including alternate names, like \s-1NEW LINE.\s0  \f(CW\*(C`viacode\*(C'\fR uses the
original name, \*(L"\s-1LINE FEED\*(R"\s0 in preference to the alternate.  Similarly the
name returned for U+FEFF is \*(L"\s-1ZERO WIDTH\s0 NO-BREAK \s-1SPACE\*(R",\s0 not \*(L"\s-1BYTE ORDER
MARK\*(R".\s0
.PP
Until Unicode 6.1, the 4 control characters U+0080, U+0081, U+0084, and U+0099
did not have names nor aliases.
To preserve backwards compatibility, any alias you define for these code
points will be returned by this function, in preference to the official name.
.PP
Some code points also have abbreviated names, such as \*(L"\s-1LF\*(R"\s0 or \*(L"\s-1NL\*(R".\s0
\&\f(CW\*(C`viacode\*(C'\fR never returns these.
.PP
Because a name correction may be added in future Unicode releases, the name
that \f(CW\*(C`viacode\*(C'\fR returns may change as a result.  This is a rare event, but it
does happen.
.SH "CUSTOM TRANSLATORS"
.IX Header "CUSTOM TRANSLATORS"
The mechanism of translation of \f(CW\*(C`\eN{...}\*(C'\fR escapes is general and not
hardwired into \fIcharnames.pm\fR.  A module can install custom
translations (inside the scope which \f(CW\*(C`use\*(C'\fRs the module) with the
following magic incantation:
.PP
.Vb 4
\&    sub import {
\&        shift;
\&        $^H{charnames} = \e&translator;
\&    }
.Ve
.PP
Here \fBtranslator()\fR is a subroutine which takes \fI\s-1CHARNAME\s0\fR as an
argument, and returns text to insert into the string instead of the
\&\f(CW\*(C`\eN{\f(CICHARNAME\f(CW}\*(C'\fR escape.
.PP
This is the only way you can create a custom named sequence of code points.
.PP
Since the text to insert should be different
in \f(CW\*(C`bytes\*(C'\fR mode and out of it, the function should check the current
state of \f(CW\*(C`bytes\*(C'\fR\-flag as in:
.PP
.Vb 9
\&    use bytes ();                      # for $bytes::hint_bits
\&    sub translator {
\&        if ($^H & $bytes::hint_bits) {
\&            return bytes_translator(@_);
\&        }
\&        else {
\&            return utf8_translator(@_);
\&        }
\&    }
.Ve
.PP
See \*(L"\s-1CUSTOM ALIASES\*(R"\s0 above for restrictions on \fI\s-1CHARNAME\s0\fR.
.PP
Of course, \f(CW\*(C`vianame\*(C'\fR, \f(CW\*(C`viacode\*(C'\fR, and \f(CW\*(C`string_vianame\*(C'\fR would need to be
overridden as well.
.SH "BUGS"
.IX Header "BUGS"
\&\fBvianame()\fR normally returns an ordinal code point, but when the input name is of
the form \f(CW\*(C`U+...\*(C'\fR, it returns a chr instead.  In this case, if \f(CW\*(C`use bytes\*(C'\fR is
in effect and the character won't fit into a byte, it returns \f(CW\*(C`undef\*(C'\fR and
raises a warning.
.PP
Since evaluation of the translation function (see \*(L"\s-1CUSTOM
TRANSLATORS\*(R"\s0) happens in the middle of compilation (of a string
literal), the translation function should not do any \f(CW\*(C`eval\*(C'\fRs or
\&\f(CW\*(C`require\*(C'\fRs.  This restriction should be lifted (but is low priority) in
a future version of Perl.

Man Man