diff options
author | Yitzchak Scott-Thoennes <sthoenna@efn.org> | 2004-02-08 16:51:45 -0800 |
---|---|---|
committer | Rafael Garcia-Suarez <rgarciasuarez@gmail.com> | 2004-02-09 21:09:14 +0000 |
commit | b8effcb5f9b63a03069dd25d50d5af552626f11a (patch) | |
tree | 9d50832049759032a13ad02a175d68085d08cc8c /lib | |
parent | bf2b43ffd0997b89e460287fefa9f059ed6ae7ce (diff) | |
download | perl-b8effcb5f9b63a03069dd25d50d5af552626f11a.tar.gz |
reduce overhead of charnames.pm, make op/pat.t work under miniperl
Message-ID: <20040209085145.GA3204@efn.org>
(plus an etymological notice)
p4raw-id: //depot/perl@22291
Diffstat (limited to 'lib')
-rw-r--r-- | lib/charnames.pm | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/lib/charnames.pm b/lib/charnames.pm index 3457b8b66b..4f7fdeb6ed 100644 --- a/lib/charnames.pm +++ b/lib/charnames.pm @@ -3,7 +3,7 @@ use strict; use warnings; use Carp; use File::Spec; -our $VERSION = '1.02'; +our $VERSION = '1.03'; use bytes (); # for $bytes::hint_bits $charnames::hint_bits = 0x20000; # HINT_LOCALIZE_HH @@ -238,7 +238,19 @@ sub import } } # import -require Unicode::UCD; # for Unicode::UCD::_getcode() +# this comes actually from Unicode::UCD, but it avoids the +# overhead of loading it +sub _getcode { + my $arg = shift; + + if ($arg =~ /^[1-9]\d*$/) { + return $arg; + } elsif ($arg =~ /^(?:[Uu]\+|0[xX])?([[:xdigit:]]+)$/) { + return hex($1); + } + + return; +} my %viacode; @@ -250,7 +262,7 @@ sub viacode } my $arg = shift; - my $code = Unicode::UCD::_getcode($arg); + my $code = _getcode($arg); my $hex; |