Unicode::UCD::prop_invlist() Allow to return internal property
authorKarl Williamson <public@khwilliamson.com>
Mon, 18 Jun 2012 18:38:41 +0000 (12:38 -0600)
committerKarl Williamson <public@khwilliamson.com>
Thu, 2 Aug 2012 15:24:52 +0000 (09:24 -0600)
This creates an optional undocumented parameter to this function to
allow it to return the inversion list of an internal-only Perl property.
This will be used by other functions in Perl, but should not be
documented, as we don't want to encourage the use of internal-only
properties, which are subject to change or removal without notice.

lib/Unicode/UCD.pm

index 81d729e..a2557d8 100644 (file)
@@ -5,7 +5,7 @@ use warnings;
 no warnings 'surrogate';    # surrogates can be inputs to this
 use charnames ();
 
-our $VERSION = '0.44';
+our $VERSION = '0.45';
 
 require Exporter;
 
@@ -2127,8 +2127,12 @@ properties, and will return C<undef> if called with one of those.
 our %loose_defaults;
 our $MAX_UNICODE_CODEPOINT;
 
-sub prop_invlist ($) {
+sub prop_invlist ($;$) {
     my $prop = $_[0];
+
+    # Undocumented way to get at Perl internal properties
+    my $internal_ok = defined $_[1] && $_[1] eq '_perl_core_internal_ok';
+
     return if ! defined $prop;
 
     require "utf8_heavy.pl";
@@ -2145,7 +2149,7 @@ sub prop_invlist ($) {
               || ref $swash eq ""
               || $swash->{'BITS'} != 1
               || $swash->{'USER_DEFINED'}
-              || $prop =~ /^\s*_/;
+              || (! $internal_ok && $prop =~ /^\s*_/);
 
     if ($swash->{'EXTRAS'}) {
         carp __PACKAGE__, "::prop_invlist: swash returned for $prop unexpectedly has EXTRAS magic";