summaryrefslogtreecommitdiff
path: root/lib/vars.pm
diff options
context:
space:
mode:
authorJarkko Hietaniemi <jhi@iki.fi>2002-04-16 03:59:00 +0000
committerJarkko Hietaniemi <jhi@iki.fi>2002-04-16 03:59:00 +0000
commit82686b017bb20f55e16f84c47f7ac0bf8d0c714b (patch)
treee7ad28a90ea768b323c2fb37103841ceb7b8dd93 /lib/vars.pm
parent58858581d2d18dc2bff021fb2c755408c36929c4 (diff)
downloadperl-82686b017bb20f55e16f84c47f7ac0bf8d0c714b.tar.gz
my $utf8here, our $utf8here, and package variable $utf8here.
The actual minimal fix is in utf8.c and from NI-S, the rest are the tests (in fresh_perl since I couldn't get them easily to work elsewhere) and a slight behaviour change: previously UTF-8 identifiers had to start with an alphabetic character. No more so, now they can start with an (Unicode) ID_Continue character (which however is not a (Unicode) digit). (Limiting the first character to ID_Start would be rather restrictive, since ID_Start allows only alphabetic letters.) TODO: use vars qw($utf8here). This I don't find to be a showstopper. p4raw-id: //depot/perl@15943
Diffstat (limited to 'lib/vars.pm')
-rw-r--r--lib/vars.pm11
1 files changed, 7 insertions, 4 deletions
diff --git a/lib/vars.pm b/lib/vars.pm
index c3a02234e9..233979d264 100644
--- a/lib/vars.pm
+++ b/lib/vars.pm
@@ -12,6 +12,10 @@ sub import {
my ($pack, @imports) = @_;
my ($sym, $ch);
foreach (@imports) {
+ # TODO: UTF-8 names: (the unpack is quite wrong,
+ # /^(.)(.*)/ would probably be better.) While you
+ # are at it, until declaring empty package is made
+ # to work the * is too lenient.
($ch, $sym) = unpack('a1a*', $_);
if ($sym =~ tr/A-Za-z_0-9//c) {
# time for a more-detailed check-up
@@ -20,10 +24,9 @@ sub import {
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')) &&
- # Either no 'use utf8' or if utf8, no non-word
- ($^H & 0x00800000 == 0 || # matches $utf8::hint_bits
- $sym =~ /\W/) ) {
+ } elsif (($^H &= strict::bits('vars'))) {
+ # TODO: UTF-8 names: be careful to load the UTF-8
+ # machinery only if the symbol requires it.
require Carp;
Carp::croak("'$_' is not a valid variable name under strict vars");
}