# New Ticket Created by Anno Siegel
# Please include the string: [perl #32400]
# in the subject line of all future correspondence about this issue.
# <URL: http://rt.perl.org:80/rt3/Ticket/Display.html?id=32400 >
This is a bug report for perl from [EMAIL PROTECTED],
generated with the help of perlbug 1.34 running under perl v5.8.1.
The constant pragma warns
Constant name '_123_456' has unknown problems at...
when you try to define a constant that begins with "_" and consists
only of digits and "_". In other contexts, these are valid identifiers,
and the wording in perldata
... identifier, that is, a string beginning with a letter or underscore,
and containing letters, underscores, and digits.
seems to indicate the same. I suggest dropping the corresponding
clause from warnings.pm.
I had a little correspondence with Tom Phoenix about this, and he
agrees. In particular:
If you submit a patch to the Perl developers (via perlbug), I would
greatly appreciate it if you remove my e-mail address from that
comment in your patch.
...so it's no problem when his address disappears along with the comment.
Regards,
Anno
--------------------------------------------------------------------------
--- orig/lib/constant.pm Wed Nov 10 18:32:43 2004
+++ perl-5.8.5/lib/constant.pm Wed Nov 10 19:16:05 2004
@@ -71,11 +71,6 @@
} elsif ($forced_into_main{$name}) {
warnings::warn("Constant name '$name' is " .
"forced into package main::");
- } else {
- # Catch-all - what did I miss? If you get this error,
- # please let me know what your constant's name was.
- # Write to <[EMAIL PROTECTED]>. Thanks!
- warnings::warn("Constant name '$name' has unknown
problems");
}
}
--- orig/lib/constant.t Wed Nov 10 18:32:43 2004
+++ perl-5.8.5/lib/constant.t Wed Nov 10 19:20:34 2004
@@ -14,7 +14,7 @@
######################### We start with some black magic to print on failure.
-BEGIN { $| = 1; print "1..82\n"; }
+BEGIN { $| = 1; print "1..83\n"; }
END {print "not ok 1\n" unless $loaded;}
use constant 1.01;
$loaded = 1;
@@ -249,3 +249,12 @@
test 80, @{+PHFAM} == SPIT->(THREE+1);
test 81, THREE**3 eq SPIT->(@{+FAMILY}**3);
test 82, AGES->{FAMILY->[THREE-1]} == PHFAM->[THREE];
+
+# Allow name of digits/underscores only if it begins with underscore
+{
+ use warnings FATAL => 'constant';
+ eval q{
+ use constant _1_2_3 => 'allowed';
+ };
+}
+test 83, length( $@) == 0;
---
Flags:
category=library
severity=low
---
Site configuration information for perl v5.8.1:
Configured by anno4000 at Wed Oct 1 12:15:29 MEST 2003.
Summary of my perl5 (revision 5.0 version 8 subversion 1) configuration:
Platform:
osname=linux, osvers=2.0.36, archname=i586-linux
uname='linux lublin.zrz.tu-berlin.de 2.0.36 #2 mon jun 26 12:24:02 mest
2000 i586 unknown '
config_args='-des'
hint=recommended, useposix=true, d_sigaction=define
usethreads=undef use5005threads=undef useithreads=undef
usemultiplicity=undef
useperlio=define d_sfio=undef uselargefiles=define usesocks=undef
use64bitint=undef use64bitall=undef uselongdouble=undef
usemymalloc=n, bincompat5005=undef
Compiler:
cc='cc', ccflags ='-I/usr/local/include -D_LARGEFILE_SOURCE
-D_FILE_OFFSET_BITS=64',
optimize='-O2',
cppflags='-I/usr/local/include'
ccversion='', gccversion='2.7.2.3', gccosandvers=''
intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234
d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12
ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t',
lseeksize=4
alignbytes=4, prototype=define
Linker and Libraries:
ld='cc', ldflags =' -L/usr/local/lib'
libpth=/usr/local/lib /lib /usr/lib
libs=-lnsl -lndbm -lgdbm -ldb -ldl -lm -lcrypt -lutil -lc -lposix
perllibs=-lnsl -ldl -lm -lcrypt -lutil -lc -lposix
libc=/lib/libc-2.0.7.so, so=so, useshrplib=false, libperl=libperl.a
gnulibc_version='2.0'
Dynamic Linking:
dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-rdynamic'
cccdlflags='-fpic', lddlflags='-shared -L/usr/local/lib'
Locally applied patches:
---
@INC for perl v5.8.1:
/opt/home/anno4000/lib/perl
/usr/local/lib/perl5/5.8.1/i586-linux
/usr/local/lib/perl5/5.8.1
/usr/local/lib/perl5/site_perl/5.8.1/i586-linux
/usr/local/lib/perl5/site_perl/5.8.1
/usr/local/lib/perl5/site_perl
.
---
Environment for perl v5.8.1:
HOME=/opt/home/anno4000
LANG (unset)
LANGUAGE (unset)
LD_LIBRARY_PATH=/usr/X11R6/lib:/usr/local/LessTif/Motif1.2/lib
LOGDIR (unset)
PATH=/opt/home/anno4000/bin:/sbin:/usr/local/bin:/bin:/usr/bin:/usr/sbin:/usr/X11R6/bin:/usr/openwin/bin:/usr/games
PERL5LIB=/opt/home/anno4000/lib/perl
PERL_BADLANG (unset)
PERL_PRIVLIB=/usr/local/lib/perl5/5.8.1
PERL_SITELIB=/usr/local/lib/perl5/site_perl/5.8.1
SHELL=/bin/tcsh