/usr/share/perl5
NameSizeModeActions
App/-0755rm
Archive/-0755rm
Attribute/-0755rm
autodie/-0755rm
B/-0755rm
Carp/-0755rm
CGI/-0755rm
Class/-0755rm
Config/-0755rm
CPAN/-0755rm
CPANPLUS/-0755rm
DBIx/-0755rm
DBM_Filter/-0755rm
Devel/-0755rm
Digest/-0755rm
Encode/-0755rm
encoding/-0755rm
Exporter/-0755rm
ExtUtils/-0755rm
File/-0755rm
Filter/-0755rm
Getopt/-0755rm
HTML/-0755rm
I18N/-0755rm
IO/-0755rm
IPC/-0755rm
JSON/-0755rm
Locale/-0755rm
Log/-0755rm
Math/-0755rm
Memoize/-0755rm
Module/-0755rm
Net/-0755rm
Object/-0755rm
overload/-0755rm
Package/-0755rm
Params/-0755rm
Parse/-0755rm
PerlIO/-0755rm
Pod/-0755rm
pod/-0755rm
Search/-0755rm
TAP/-0755rm
Term/-0755rm
Test/-0755rm
Test2/-0755rm
Text/-0755rm
Thread/-0755rm
Tie/-0755rm
Time/-0755rm
Unicode/-0755rm
unicore/-0755rm
URI/-0755rm
User/-0755rm
vendor_perl/-0755rm
version/-0755rm
warnings/-0755rm
abbrev.pl8380644editdlrm
AnyDBM_File.pm25940644editdlrm
assert.pl12980644editdlrm
attributes.pm148770644editdlrm
autodie.pm117630644editdlrm
AutoLoader.pm149970644editdlrm
AutoSplit.pm196370644editdlrm
autouse.pm42380644editdlrm
base.pm69860644editdlrm
Benchmark.pm285300644editdlrm
bigfloat.pl73680644editdlrm
bigint.pl89590644editdlrm
bigint.pm178520644editdlrm
bignum.pm186730644editdlrm
bigrat.pl44760644editdlrm
bigrat.pm144420644editdlrm
blib.pm21060644editdlrm
bytes.pm23840644editdlrm
bytes_heavy.pl7580644editdlrm
cacheout.pl11220644editdlrm
Carp.pm76110644editdlrm
CGI.pm2614780644editdlrm
charnames.pm156700644editdlrm
complete.pl31910644editdlrm
constant.pm125280644editdlrm
CORE.pod15690644editdlrm
CPAN.pm1309070644editdlrm
CPANPLUS.pm72690644editdlrm
ctime.pl19930644editdlrm
DB.pm192020644editdlrm
DBM_Filter.pm144150644editdlrm
diagnostics.pm173800644editdlrm
Digest.pm104120644editdlrm
DirHandle.pm19370644editdlrm
dotsh.pl21750644editdlrm
Dumpvalue.pm168990644editdlrm
dumpvar.pl152750644editdlrm
English.pm44880644editdlrm
Env.pm51700644editdlrm
exceptions.pl17360644editdlrm
Expect.pm547250644editdlrm
Expect.pod437350644editdlrm
Exporter.pm185950644editdlrm
fastcwd.pl10190644editdlrm
Fatal.pm409660644editdlrm
feature.pm50920644editdlrm
fields.pm95070644editdlrm
FileCache.pm55700644editdlrm
FileHandle.pm67780644editdlrm
filetest.pm40030644editdlrm
find.pl11850644editdlrm
FindBin.pm56580644editdlrm
finddepth.pl11300644editdlrm
flush.pl6420644editdlrm
getcwd.pl14270644editdlrm
getopt.pl13220644editdlrm
getopts.pl14060644editdlrm
hostname.pl7270644editdlrm
if.pm11660644editdlrm
importenv.pl2830644editdlrm
integer.pm32660644editdlrm
less.pm30840644editdlrm
locale.pm8200644editdlrm
look.pl12550644editdlrm
Memoize.pm352950644editdlrm
newgetopt.pl22130644editdlrm
NEXT.pm184810644editdlrm
ok.pm9670444editdlrm
open.pm77400644editdlrm
open2.pl1850644editdlrm
open3.pl1850644editdlrm
overload.pm480500644editdlrm
overloading.pm18010644editdlrm
parent.pm29980644editdlrm
perl5db.pl3176820644editdlrm
PerlIO.pm111220644editdlrm
pwd.pl14780644editdlrm
Safe.pm243260644editdlrm
SelectSaver.pm10760644editdlrm
SelfLoader.pm173410644editdlrm
Shell.pm86850644editdlrm
shellwords.pl2760644editdlrm
sigtrap.pm76110644editdlrm
sort.pm60930644editdlrm
stat.pl5900644editdlrm
strict.pm37160644editdlrm
subs.pm8420644editdlrm
Switch.pm285080644editdlrm
Symbol.pm47940644editdlrm
syslog.pl48060644editdlrm
tainted.pl1640644editdlrm
termcap.pl41140644editdlrm
Test.pm288000644editdlrm
Test2.pm63930444editdlrm
Thread.pm82850644editdlrm
timelocal.pl6900644editdlrm
UNIVERSAL.pm65360644editdlrm
utf8.pm69180644editdlrm
utf8_heavy.pl80010644editdlrm
validate.pl37310644editdlrm
vars.pm23580644editdlrm
version.pm10370644editdlrm
version.pod123150644editdlrm
vmsish.pm43280644editdlrm
warnings.pm161330644editdlrm
Edit: /usr/share/perl5/charnames.pm (15670B)
package charnames; use strict; use warnings; use File::Spec; our $VERSION = '1.07'; use bytes (); # for $bytes::hint_bits my %alias1 = ( # Icky 3.2 names with parentheses. 'LINE FEED' => 'LINE FEED (LF)', 'FORM FEED' => 'FORM FEED (FF)', 'CARRIAGE RETURN' => 'CARRIAGE RETURN (CR)', 'NEXT LINE' => 'NEXT LINE (NEL)', # Convenience. 'LF' => 'LINE FEED (LF)', 'FF' => 'FORM FEED (FF)', 'CR' => 'CARRIAGE RETURN (CR)', 'NEL' => 'NEXT LINE (NEL)', # More convenience. For futher convencience, # it is suggested some way using using the NamesList # aliases is implemented. 'ZWNJ' => 'ZERO WIDTH NON-JOINER', 'ZWJ' => 'ZERO WIDTH JOINER', 'BOM' => 'BYTE ORDER MARK', ); my %alias2 = ( # Pre-3.2 compatibility (only for the first 256 characters). 'HORIZONTAL TABULATION' => 'CHARACTER TABULATION', 'VERTICAL TABULATION' => 'LINE TABULATION', 'FILE SEPARATOR' => 'INFORMATION SEPARATOR FOUR', 'GROUP SEPARATOR' => 'INFORMATION SEPARATOR THREE', 'RECORD SEPARATOR' => 'INFORMATION SEPARATOR TWO', 'UNIT SEPARATOR' => 'INFORMATION SEPARATOR ONE', 'PARTIAL LINE DOWN' => 'PARTIAL LINE FORWARD', 'PARTIAL LINE UP' => 'PARTIAL LINE BACKWARD', ); my %alias3 = ( # User defined aliasses. Even more convenient :) ); my $txt; sub croak { require Carp; goto &Carp::croak; } # croak sub carp { require Carp; goto &Carp::carp; } # carp sub alias (@) { @_ or return %alias3; my $alias = ref $_[0] ? $_[0] : { @_ }; @alias3{keys %$alias} = values %$alias; } # alias sub alias_file ($) { my ($arg, $file) = @_; if (-f $arg && File::Spec->file_name_is_absolute ($arg)) { $file = $arg; } elsif ($arg =~ m/^\w+$/) { $file = "unicore/${arg}_alias.pl"; } else { croak "Charnames alias files can only have identifier characters"; } if (my @alias = do $file) { @alias == 1 && !defined $alias[0] and croak "$file cannot be used as alias file for charnames"; @alias % 2 and croak "$file did not return a (valid) list of alias pairs"; alias (@alias); return (1); } 0; } # alias_file # This is not optimized in any way yet sub charnames { my $name = shift; if (exists $alias1{$name}) { $name = $alias1{$name}; } elsif (exists $alias2{$name}) { require warnings; warnings::warnif('deprecated', qq{Unicode character name "$name" is deprecated, use "$alias2{$name}" instead}); $name = $alias2{$name}; } elsif (exists $alias3{$name}) { $name = $alias3{$name}; } my $ord; my @off; my $fname; if ($name eq "BYTE ORDER MARK") { $fname = $name; $ord = 0xFEFF; } else { ## Suck in the code/name list as a big string. ## Lines look like: ## "0052\t\tLATIN CAPITAL LETTER R\n" $txt = do "unicore/Name.pl" unless $txt; ## @off will hold the index into the code/name string of the start and ## end of the name as we find it. ## If :full, look for the name exactly if ($^H{charnames_full} and $txt =~ /\t\t\Q$name\E$/m) { @off = ($-[0], $+[0]); } ## If we didn't get above, and :short allowed, look for the short name. ## The short name is like "greek:Sigma" unless (@off) { if ($^H{charnames_short} and $name =~ /^(.+?):(.+)/s) { my ($script, $cname) = ($1, $2); my $case = $cname =~ /[[:upper:]]/ ? "CAPITAL" : "SMALL"; if ($txt =~ m/\t\t\U$script\E (?:$case )?LETTER \U\Q$cname\E$/m) { @off = ($-[0], $+[0]); } } } ## If we still don't have it, check for the name among the loaded ## scripts. if (not @off) { my $case = $name =~ /[[:upper:]]/ ? "CAPITAL" : "SMALL"; for my $script (@{$^H{charnames_scripts}}) { if ($txt =~ m/\t\t$script (?:$case )?LETTER \U\Q$name\E$/m) { @off = ($-[0], $+[0]); last; } } } ## If we don't have it by now, give up. unless (@off) { carp "Unknown charname '$name'"; return "\x{FFFD}"; } ## ## Now know where in the string the name starts. ## The code, in hex, is before that. ## ## The code can be 4-6 characters long, so we've got to sort of ## go look for it, just after the newline that comes before $off[0]. ## ## This would be much easier if unicore/Name.pl had info in ## a name/code order, instead of code/name order. ## ## The +1 after the rindex() is to skip past the newline we're finding, ## or, if the rindex() fails, to put us to an offset of zero. ## my $hexstart = rindex($txt, "\n", $off[0]) + 1; ## we know where it starts, so turn into number - ## the ordinal for the char. $ord = CORE::hex substr($txt, $hexstart, $off[0] - $hexstart); } if ($^H & $bytes::hint_bits) { # "use bytes" in effect? use bytes; return chr $ord if $ord <= 255; my $hex = sprintf "%04x", $ord; if (not defined $fname) { $fname = substr $txt, $off[0] + 2, $off[1] - $off[0] - 2; } croak "Character 0x$hex with name '$fname' is above 0xFF"; } no warnings 'utf8'; # allow even illegal characters return pack "U", $ord; } # charnames sub import { shift; ## ignore class name if (not @_) { carp("`use charnames' needs explicit imports list"); } $^H{charnames} = \&charnames ; ## ## fill %h keys with our @_ args. ## my ($promote, %h, @args) = (0); while (my $arg = shift) { if ($arg eq ":alias") { @_ or croak ":alias needs an argument in charnames"; my $alias = shift; if (ref $alias) { ref $alias eq "HASH" or croak "Only HASH reference supported as argument to :alias"; alias ($alias); next; } if ($alias =~ m{:(\w+)$}) { $1 eq "full" || $1 eq "short" and croak ":alias cannot use existing pragma :$1 (reversed order?)"; alias_file ($1) and $promote = 1; next; } alias_file ($alias); next; } if (substr($arg, 0, 1) eq ':' and ! ($arg eq ":full" || $arg eq ":short")) { warn "unsupported special '$arg' in charnames"; next; } push @args, $arg; } @args == 0 && $promote and @args = (":full"); @h{@args} = (1) x @args; $^H{charnames_full} = delete $h{':full'}; $^H{charnames_short} = delete $h{':short'}; $^H{charnames_scripts} = [map uc, keys %h]; ## ## If utf8? warnings are enabled, and some scripts were given, ## see if at least we can find one letter of each script. ## if (warnings::enabled('utf8') && @{$^H{charnames_scripts}}) { $txt = do "unicore/Name.pl" unless $txt; for my $script (@{$^H{charnames_scripts}}) { if (not $txt =~ m/\t\t$script (?:CAPITAL |SMALL )?LETTER /) { warnings::warn('utf8', "No such script: '$script'"); } } } } # import my %viacode; sub viacode { if (@_ != 1) { carp "charnames::viacode() expects one argument"; return; } my $arg = shift; # this comes actually from Unicode::UCD, where it is the named # function _getcode (), but it avoids the overhead of loading it my $hex; if ($arg =~ /^[1-9]\d*$/) { $hex = sprintf "%04X", $arg; } elsif ($arg =~ /^(?:[Uu]\+|0[xX])?([[:xdigit:]]+)$/) { $hex = $1; } else { carp("unexpected arg \"$arg\" to charnames::viacode()"); return; } # checking the length first is slightly faster if (length($hex) > 5 && hex($hex) > 0x10FFFF) { carp "Unicode characters only allocated up to U+10FFFF (you asked for U+$hex)"; return; } return $viacode{$hex} if exists $viacode{$hex}; $txt = do "unicore/Name.pl" unless $txt; return unless $txt =~ m/^$hex\t\t(.+)/m; $viacode{$hex} = $1; } # viacode my %vianame; sub vianame { if (@_ != 1) { carp "charnames::vianame() expects one name argument"; return () } my $arg = shift; return chr CORE::hex $1 if $arg =~ /^U\+([0-9a-fA-F]+)$/; return $vianame{$arg} if exists $vianame{$arg}; $txt = do "unicore/Name.pl" unless $txt; my $pos = index $txt, "\t\t$arg\n"; if ($[ <= $pos) { my $posLF = rindex $txt, "\n", $pos; (my $code = substr $txt, $posLF + 1, 6) =~ tr/\t//d; return $vianame{$arg} = CORE::hex $code; # If $pos is at the 1st line, $posLF must be $[ - 1 (not found); # then $posLF + 1 equals to $[ (at the beginning of $txt). # Otherwise $posLF is the position of "\n"; # then $posLF + 1 must be the position of the next to "\n" # (the beginning of the line). # substr($txt, $posLF + 1, 6) may be "0000\t\t", "00A1\t\t", # "10300\t", "100000", etc. So we can get the code via removing TAB. } else { return; } } # vianame 1; __END__ =head1 NAME charnames - define character names for C<\N{named}> string literal escapes =head1 SYNOPSIS use charnames ':full'; print "\N{GREEK SMALL LETTER SIGMA} is called sigma.\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 charnames ":full", ":alias" => { e_ACUTE => "LATIN SMALL LETTER E WITH ACUTE", }; print "\N{e_ACUTE} is a small letter e with an acute.\n"; use charnames (); print charnames::viacode(0x1234); # prints "ETHIOPIC SYLLABLE SEE" printf "%04X", charnames::vianame("GOTHIC LETTER AHSA"); # prints "10330" =head1 DESCRIPTION Pragma C supports arguments C<:full>, C<:short>, script names and customized aliases. If C<:full> is present, for expansion of C<\N{CHARNAME}>, the string C is first looked up in the list of standard Unicode character names. If C<:short> is present, and C has the form C, then C is looked up as a letter in script C