/usr/share/perl5
NameSizeModeActions
Attribute/-0755rm
B/-0755rm
Class/-0755rm
Compress/-0755rm
Config/-0755rm
CPAN/-0755rm
DBM_Filter/-0755rm
Devel/-0755rm
encoding/-0755rm
ExtUtils/-0755rm
File/-0755rm
Getopt/-0755rm
I18N/-0755rm
IO/-0755rm
IPC/-0755rm
Locale/-0755rm
Math/-0755rm
Memoize/-0755rm
Module/-0755rm
Net/-0755rm
overload/-0755rm
Pod/-0755rm
pod/-0755rm
Search/-0755rm
Term/-0755rm
Text/-0755rm
Thread/-0755rm
Tie/-0755rm
Time/-0755rm
Unicode/-0755rm
unicore/-0755rm
URI/-0755rm
User/-0755rm
vendor_perl/-0755rm
warnings/-0755rm
AnyDBM_File.pm26180644editdlrm
AutoLoader.pm157970644editdlrm
AutoSplit.pm196370644editdlrm
autouse.pm42380644editdlrm
base.pm109800644editdlrm
Benchmark.pm310250644editdlrm
blib.pm20860644editdlrm
bytes.pm37540644editdlrm
bytes_heavy.pl7580644editdlrm
charnames.pm208670644editdlrm
CORE.pod31880644editdlrm
DB.pm189220644editdlrm
DBM_Filter.pm143850644editdlrm
deprecate.pm30790644editdlrm
diagnostics.pm190380644editdlrm
DirHandle.pm15560644editdlrm
Dumpvalue.pm175560644editdlrm
dumpvar.pl155550644editdlrm
English.pm47610644editdlrm
feature.pm170850644editdlrm
fields.pm94890644editdlrm
FileCache.pm55720644editdlrm
FileHandle.pm67840644editdlrm
filetest.pm40030644editdlrm
FindBin.pm45610644editdlrm
if.pm33400644editdlrm
integer.pm32540644editdlrm
Internals.pod25760644editdlrm
less.pm32040644editdlrm
locale.pm48550644editdlrm
Memoize.pm361920644editdlrm
meta_notation.pm21170644editdlrm
NEXT.pm188460644editdlrm
open.pm80210644editdlrm
overload.pm533140644editdlrm
overloading.pm18080644editdlrm
perl5db.pl3164200644editdlrm
PerlIO.pm104590644editdlrm
Safe.pm250820644editdlrm
SelectSaver.pm10760644editdlrm
SelfLoader.pm176920644editdlrm
sigtrap.pm76060644editdlrm
sort.pm60810644editdlrm
strict.pm47380644editdlrm
subs.pm8480644editdlrm
Symbol.pm47990644editdlrm
Test.pm300570644editdlrm
Thread.pm82870644editdlrm
UNIVERSAL.pm65940644editdlrm
URI.pm347900644editdlrm
utf8.pm91160644editdlrm
utf8_heavy.pl316150644editdlrm
vars.pm24140644editdlrm
vmsish.pm43130644editdlrm
warnings.pm447560644editdlrm
XSLoader.pm112670644editdlrm
_charnames.pm331660644editdlrm
Edit: /usr/share/perl5/charnames.pm (20867B)
package charnames; use strict; use warnings; our $VERSION = '1.45'; use unicore::Name; # mktables-generated algorithmically-defined names use _charnames (); # The submodule for this where most of the work gets done use bytes (); # for $bytes::hint_bits use re "/aa"; # Everything in here should be ASCII # Translate between Unicode character names and their code points. # This is a wrapper around the submodule C<_charnames>. This design allows # C<_charnames> to be autoloaded to enable use of \N{...}, but requires this # module to be explicitly requested for the functions API. $Carp::Internal{ (__PACKAGE__) } = 1; sub import { shift; ## ignore class name _charnames->import(@_); } # Cache of already looked-up values. This is set to only contain # official values, and user aliases can't override them, so scoping is # not an issue. my %viacode; sub viacode { return _charnames::viacode(@_); } sub vianame { if (@_ != 1) { _charnames::carp "charnames::vianame() expects one name argument"; return () } # Looks up the character name and returns its ordinal if # found, undef otherwise. my $arg = shift; if ($arg =~ /^U\+([0-9a-fA-F]+)$/) { # khw claims that this is poor interface design. The function should # return either a an ord or a chr for all inputs; not be bipolar. But # can't change it because of backward compatibility. New code can use # string_vianame() instead. my $ord = CORE::hex $1; return pack("U", $ord) if $ord <= 255 || ! ((caller 0)[8] & $bytes::hint_bits); _charnames::carp _charnames::not_legal_use_bytes_msg($arg, chr $ord); return; } # The first 1 arg means wants an ord returned; the second that we are in # runtime, and this is the first level routine called from the user return _charnames::lookup_name($arg, 1, 1); } # vianame sub string_vianame { # Looks up the character name and returns its string representation if # found, undef otherwise. if (@_ != 1) { _charnames::carp "charnames::string_vianame() expects one name argument"; return; } my $arg = shift; if ($arg =~ /^U\+([0-9a-fA-F]+)$/) { my $ord = CORE::hex $1; return pack("U", $ord) if $ord <= 255 || ! ((caller 0)[8] & $bytes::hint_bits); _charnames::carp _charnames::not_legal_use_bytes_msg($arg, chr $ord); return; } # The 0 arg means wants a string returned; the 1 arg means that we are in # runtime, and this is the first level routine called from the user return _charnames::lookup_name($arg, 0, 1); } # string_vianame 1; __END__ =encoding utf8 =head1 NAME charnames - access to Unicode character names and named character sequences; also define character names =head1 SYNOPSIS use charnames ':full'; print "\N{GREEK SMALL LETTER SIGMA} is called sigma.\n"; print "\N{LATIN CAPITAL LETTER E WITH VERTICAL LINE BELOW}", " is an officially named sequence of two Unicode characters\n"; use charnames ':loose'; print "\N{Greek small-letter sigma}", "can be used to ignore case, underscores, most blanks," "and when you aren't sure if the official name has hyphens\n"; use charnames ':short'; print "\N{greek:Sigma} is an upper-case sigma.\n"; use charnames qw(cyrillic greek); print "\N{sigma} is Greek sigma, and \N{be} is Cyrillic b.\n"; use utf8; use charnames ":full", ":alias" => { e_ACUTE => "LATIN SMALL LETTER E WITH ACUTE", mychar => 0xE8000, # Private use area "自転車に乗る人" => "BICYCLIST" }; print "\N{e_ACUTE} is a small letter e with an acute.\n"; print "\N{mychar} allows me to name private use characters.\n"; print "And I can create synonyms in other languages,", " such as \N{自転車に乗る人} for "BICYCLIST (U+1F6B4)\n"; 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" =head1 DESCRIPTION Pragma C 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. All forms of the pragma enable use of the following 3 functions: =over =item * L)> for run-time lookup of a either a character name or a named character sequence, returning its string representation =item * L)> for run-time lookup of a character name (but not a named character sequence) to get its ordinal value (code point) =item * L)> for run-time lookup of a code point to get its Unicode name. =back Starting in Perl v5.16, any occurrence of C<\N{I}> sequences in a double-quotish string automatically loads this module with arguments C<:full> and C<:short> (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 S> was required to enable this usage. (However, prior to v5.16, the form C> did not enable C<\N{I}>.) Note that C<\N{U+I<...>}>, where the I<...> 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, C<"\N{U+263a}"> is the Unicode (white background, black foreground) smiley face equivalent to C<"\N{WHITE SMILING FACE}">. Also note, C<\N{I<...>}> can mean a regex quantifier instead of a character name, when the I<...> is a number (or comma separated pair of numbers (see L), and is not related to this pragma. The C pragma supports arguments C<:full>, C<:loose>, C<:short>, script names and L. If C<:full> is present, for expansion of C<\N{I}>, the string I is first looked up in the list of standard Unicode character names. C<:loose> is a variant of C<:full> which allows I to be less precisely specified. Details are in L. If C<:short> is present, and I has the form C:I>, then I is looked up as a letter in script I