integrate cfgperl contents into mainline
[p5sagit/p5-mst-13.2.git] / lib / constant.pm
index 31f47fb..b4fcd42 100644 (file)
@@ -1,15 +1,15 @@
 package constant;
 
 use strict;
-use vars qw( $VERSION %declared );
+use 5.005_64;
+
+our($VERSION, %declared);
 $VERSION = '1.01';
 
 #=======================================================================
 
-require 5.005_62;
-
 # Some names are evil choices.
-my %keywords = map +($_, 1), qw{ BEGIN INIT STOP END DESTROY AUTOLOAD };
+my %keywords = map +($_, 1), qw{ BEGIN INIT CHECK END DESTROY AUTOLOAD };
 
 my %forced_into_main = map +($_, 1),
     qw{ STDIN STDOUT STDERR ARGV ARGVOUT ENV INC SIG };
@@ -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.