diff options
author | Gurusamy Sarathy <gsar@cpan.org> | 2000-03-03 02:02:50 +0000 |
---|---|---|
committer | Gurusamy Sarathy <gsar@cpan.org> | 2000-03-03 02:02:50 +0000 |
commit | 5bc457ce78ccec3d76158b92af16e3fadd82c224 (patch) | |
tree | 25ef101815f21728ad36764034ab1c0ff3866f6c /lib/constant.pm | |
parent | 7c1d48a58e96316fb1cc83908d021dc029328ce5 (diff) | |
download | perl-5bc457ce78ccec3d76158b92af16e3fadd82c224.tar.gz |
relax restrictions on constant names a bit (from M J T Guy)
p4raw-id: //depot/perl@5463
Diffstat (limited to 'lib/constant.pm')
-rw-r--r-- | lib/constant.pm | 7 |
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. |