charnames: Check for enabled warnings before warning
authorKarl Williamson <public@khwilliamson.com>
Thu, 29 Nov 2012 03:35:45 +0000 (20:35 -0700)
committerKarl Williamson <public@khwilliamson.com>
Thu, 29 Nov 2012 15:59:02 +0000 (08:59 -0700)
This message should be suppressed if non_unicode warnings are turned
off.

lib/_charnames.pm
lib/charnames.pm

index bbb7378..c9bca48 100644 (file)
@@ -7,7 +7,7 @@ package _charnames;
 use strict;
 use warnings;
 use File::Spec;
-our $VERSION = '1.33';
+our $VERSION = '1.34';
 use unicore::Name;    # mktables-generated algorithmically-defined names
 
 use bytes ();          # for $bytes::hint_bits
@@ -765,7 +765,9 @@ sub viacode {
   # Here there is no user-defined alias, return any official one.
   return $return if defined $return;
 
-  if (CORE::hex($hex) > 0x10FFFF) {
+  if (CORE::hex($hex) > 0x10FFFF
+      && warnings::enabled('non_unicode'))
+  {
       carp "Unicode characters only allocated up to U+10FFFF (you asked for U+$hex)";
   }
   return;
index 559dc4f..2dd3b62 100644 (file)
@@ -1,7 +1,7 @@
 package charnames;
 use strict;
 use warnings;
-our $VERSION = '1.33';
+our $VERSION = '1.34';
 use unicore::Name;    # mktables-generated algorithmically-defined names
 use _charnames ();    # The submodule for this where most of the work gets done