From: Anno Siegel Date: Wed, 10 Nov 2004 18:30:38 +0000 (+0000) Subject: [perl #32400] Unnecessary warning from constant.pm X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=5b673cda9907afd397f1e4108acdb4210b61c4ca;p=p5sagit%2Fp5-mst-13.2.git [perl #32400] Unnecessary warning from constant.pm From: Anno Siegel (via RT) Message-ID: p4raw-id: //depot/perl@23497 --- diff --git a/lib/constant.pm b/lib/constant.pm index 93086d5..159c299 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 . Thanks! - warnings::warn("Constant name '$name' has unknown problems"); } } diff --git a/lib/constant.t b/lib/constant.t index 51902eb..826a8de 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 '' ); +}