summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnno Siegel <anno4000@lublin.zrz.tu-berlin.de>2004-11-10 18:30:38 +0000
committerRafael Garcia-Suarez <rgarciasuarez@gmail.com>2004-11-12 21:11:48 +0000
commit5b673cda9907afd397f1e4108acdb4210b61c4ca (patch)
tree19c22d8b69b7d1c6b1b836b94f053261822bdafc
parentfa11829f4b6d56533794dd127f3d1068d9593670 (diff)
downloadperl-5b673cda9907afd397f1e4108acdb4210b61c4ca.tar.gz
[perl #32400] Unnecessary warning from constant.pm
From: Anno Siegel (via RT) <perlbug-followup@perl.org> Message-ID: <rt-3.0.11-32400-100099.4.31094423840584@perl.org> p4raw-id: //depot/perl@23497
-rw-r--r--lib/constant.pm7
-rw-r--r--lib/constant.t11
2 files changed, 11 insertions, 7 deletions
diff --git a/lib/constant.pm b/lib/constant.pm
index 93086d5398..159c29978a 100644
--- a/lib/constant.pm
+++ b/lib/constant.pm
@@ -5,7 +5,7 @@ use 5.006_00;
use warnings::register;
our($VERSION, %declared);
-$VERSION = '1.04';
+$VERSION = '1.05';
#=======================================================================
@@ -71,11 +71,6 @@ sub import {
} 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 <rootbeer@redcat.com>. Thanks!
- warnings::warn("Constant name '$name' has unknown problems");
}
}
diff --git a/lib/constant.t b/lib/constant.t
index 51902eb4ce..826a8de495 100644
--- a/lib/constant.t
+++ b/lib/constant.t
@@ -14,7 +14,7 @@ END { print STDERR @warnings }
use strict;
-use Test::More tests => 74;
+use Test::More tests => 75;
my $TB = Test::More->builder;
BEGIN { use_ok('constant'); }
@@ -245,3 +245,12 @@ is @{+FAMILY}, @{RFAM->[0]};
is FAMILY->[2], RFAM->[0]->[2];
is AGES->{FAMILY->[1]}, 28;
is THREE**3, SPIT->(@{+FAMILY}**3);
+
+# Allow name of digits/underscores only if it begins with underscore
+{
+ use warnings FATAL => 'constant';
+ eval q{
+ use constant _1_2_3 => 'allowed';
+ };
+ ok( $@ eq '' );
+}