perl_mlb
view release on metacpan or search on metacpan
charnames.pm view on Meta::CPAN
} 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.
charnames.pm view on Meta::CPAN
}
if (m/^:/ and ! ($_ eq ":full" || $_ eq ":short")) {
warn "unsupported special '$_' in charnames";
next;
}
push @args, $_;
}
@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}}) {
overload.pm view on Meta::CPAN
elsif (!ref $_ [1] || "$_[1]" !~ /CODE\(0x[\da-f]+\)$/) {
# Can't use C<ref $_[1] eq "CODE"> above as code references can be
# blessed, and C<ref> would return the package the ref is blessed into.
if (warnings::enabled) {
$_ [1] = "undef" unless defined $_ [1];
warnings::warn ("`$_[1]' is not a code reference");
}
}
else {
$^H{$_[0]} = $_[1];
$^H |= $constants{$_[0]} | $overload::hint_bits;
}
shift, shift;
}
}
sub remove_constant {
# Arguments: what, sub
while (@_) {
delete $^H{$_[0]};
$^H &= ~ $constants{$_[0]};
shift, shift;
}
}
1;
__END__
=head1 NAME
my ($sym, $ch);
foreach (@imports) {
if (($ch, $sym) = /^([\$\@\%\*\&])(.+)/) {
if ($sym =~ /\W/) {
# time for a more-detailed check-up
if ($sym =~ /^\w+[[{].*[]}]$/) {
require Carp;
Carp::croak("Can't declare individual elements of hash or array");
} elsif (warnings::enabled() and length($sym) == 1 and $sym !~ tr/a-zA-Z//) {
warnings::warn("No need to declare built-in vars");
} elsif (($^H &= strict::bits('vars'))) {
require Carp;
Carp::croak("'$_' is not a valid variable name under strict vars");
}
}
$sym = "${callpack}::$sym" unless $sym =~ /::/;
*$sym =
( $ch eq "\$" ? \$$sym
: $ch eq "\@" ? \@$sym
: $ch eq "\%" ? \%$sym
: $ch eq "\*" ? \*$sym
( run in 1.422 second using v1.01-cache-2.11-cpan-49f99fa48dc )