summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGurusamy Sarathy <gsar@cpan.org>2000-03-03 02:02:50 +0000
committerGurusamy Sarathy <gsar@cpan.org>2000-03-03 02:02:50 +0000
commit5bc457ce78ccec3d76158b92af16e3fadd82c224 (patch)
tree25ef101815f21728ad36764034ab1c0ff3866f6c
parent7c1d48a58e96316fb1cc83908d021dc029328ce5 (diff)
downloadperl-5bc457ce78ccec3d76158b92af16e3fadd82c224.tar.gz
relax restrictions on constant names a bit (from M J T Guy)
p4raw-id: //depot/perl@5463
-rw-r--r--lib/constant.pm7
1 files changed, 1 insertions, 6 deletions
diff --git a/lib/constant.pm b/lib/constant.pm
index bbfdb78ec4..b4fcd421ac 100644
--- a/lib/constant.pm
+++ b/lib/constant.pm
@@ -35,7 +35,7 @@ sub import {
my $pkg = caller;
# Normal constant name
- if ($name =~ /^(?:[A-Z]\w|_[A-Z])\w*\z/ and !$forbidden{$name}) {
+ if ($name =~ /^_?[^\W_0-9]\w*\z/ and !$forbidden{$name}) {
# Everything is okay
# Name forced into main, but we're not in main. Fatal.
@@ -58,11 +58,6 @@ sub import {
} elsif ($forced_into_main{$name}) {
Carp::carp("Constant name '$name' is " .
"forced into package main::");
- } elsif (1 == length $name) {
- Carp::carp("Constant name '$name' is too short");
- } elsif ($name =~ /^_?[a-z\d]/) {
- Carp::carp("Constant name '$name' should " .
- "have an initial capital letter");
} else {
# Catch-all - what did I miss? If you get this error,
# please let me know what your constant's name was.