From: Gurusamy Sarathy Date: Fri, 3 Mar 2000 02:02:50 +0000 (+0000) Subject: relax restrictions on constant names a bit (from M J T Guy) X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=5bc457ce78ccec3d76158b92af16e3fadd82c224;p=p5sagit%2Fp5-mst-13.2.git relax restrictions on constant names a bit (from M J T Guy) p4raw-id: //depot/perl@5463 --- diff --git a/lib/constant.pm b/lib/constant.pm index bbfdb78..b4fcd42 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.