#endif /* EBCDIC POSIX-BC */
/* Generated from:
- * a8eba313c19fa856f367bbe7fad314704c885e24516676452256c0d4420a9c55 lib/Unicode/UCD.pm
+ * 083180df694deb1fc173361406c1a75619fb8376403db3a76dc585c1e3951eca lib/Unicode/UCD.pm
* 827aa7ee45ca9fe09f3e0969a5a27a69ce58a6c7134548125266210018d27b49 lib/unicore/ArabicShaping.txt
* 3748fbbe9d280a9da700bfd0c28beaaf6f32a67ec263a124fcb0a4095a30fae5 lib/unicore/BidiBrackets.txt
* 3925329c2432fa7248b2e180cddcedb9a4f9eafbbb10ab9e105eaf833043b2fb lib/unicore/BidiMirroring.txt
charblocks charscripts
charinrange
charprop
+ charprops_all
general_categories bidi_types
compexcl
casefold all_casefolds casespec
use Unicode::UCD 'charprop';
my $value = charprop($codepoint, $property);
+ use Unicode::UCD 'charprops_all';
+ my $all_values_hash_ref = charprops_all($codepoint);
+
use Unicode::UCD 'casefold';
my $casefold = casefold($codepoint);
}
}
+=head2 B<charprops_all()>
+
+ use Unicode::UCD 'charprops_all';
+
+ my $%properties_of_A_hash_ref = charprops_all("U+41");
+
+This returns a reference to a hash whose keys are all the distinct Unicode (no
+Perl extension) properties, and whose values are the respective values for
+those properties for the input L</code point argument>.
+
+Each key is the property name in its longest, most descriptive form. The
+values are what L</charprop()> would return.
+
+This function is expensive in time and memory.
+
+=cut
+
+sub charprops_all($) {
+ my $input_cp = shift;
+
+ my $cp = _getcode($input_cp);
+ croak __PACKAGE__, "::charprops_all: unknown code point '$input_cp'" unless defined $cp;
+
+ my %return;
+
+ require "unicore/UCD.pl";
+
+ foreach my $prop (keys %Unicode::UCD::prop_aliases) {
+
+ # Don't return a Perl extension. (This is the only one that
+ # %prop_aliases has in it.)
+ next if $prop eq 'perldecimaldigit';
+
+ # Use long name for $prop in the hash
+ $return{scalar prop_aliases($prop)} = charprop($cp, $prop);
+ }
+
+ return \%return;
+}
+
=head2 B<charblock()>
use Unicode::UCD 'charblock';
use strict;
use Test::More;
-use Unicode::UCD qw(charinfo charprop);
+use Unicode::UCD qw(charinfo charprop charprops_all);
my $input_record_separator = 7; # Make sure Unicode::UCD isn't affected by
$/ = $input_record_separator; # setting this.
is(charprop(utf8::unicode_to_native(0xAD), "NFKC_Casefold"), "",
"Verify charprop can handle an \"\" in ae-type property");
+my $mark_props_ref = charprops_all(0x300);
+is($mark_props_ref->{'Bidi_Class'}, "Nonspacing_Mark",
+ "Next tests are charprops_all of 0x300");
+is($mark_props_ref->{'Bidi_Mirrored'}, "No");
+is($mark_props_ref->{'Canonical_Combining_Class'}, "Above");
+is($mark_props_ref->{'Case_Folding'}, "\x{300}");
+is($mark_props_ref->{'Decomposition_Mapping'}, "\x{300}");
+is($mark_props_ref->{'Decomposition_Type'}, "None");
+is($mark_props_ref->{'General_Category'}, "Nonspacing_Mark");
+is($mark_props_ref->{'ISO_Comment'}, "");
+is($mark_props_ref->{'Lowercase_Mapping'}, "\x{300}");
+is($mark_props_ref->{'Name'}, "COMBINING GRAVE ACCENT");
+is($mark_props_ref->{'Numeric_Type'}, "None");
+is($mark_props_ref->{'Numeric_Value'}, "NaN");
+is($mark_props_ref->{'Simple_Case_Folding'}, "\x{300}");
+is($mark_props_ref->{'Simple_Lowercase_Mapping'}, "\x{300}");
+is($mark_props_ref->{'Simple_Titlecase_Mapping'}, "\x{300}");
+is($mark_props_ref->{'Simple_Uppercase_Mapping'}, "\x{300}");
+is($mark_props_ref->{'Titlecase_Mapping'}, "\x{300}");
+is($mark_props_ref->{'Unicode_1_Name'}, "NON-SPACING GRAVE");
+is($mark_props_ref->{'Uppercase_Mapping'}, "\x{300}");
+
use Unicode::UCD qw(charblocks charscripts);
my $charblocks = charblocks();
The value of any Unicode (not including Perl extensions) character
property mentioned above for any single code point is available through
-L<Unicode::UCD/charprop()>.
+L<Unicode::UCD/charprop()>. L<Unicode::UCD/charprops_all()> returns the
+values of all the Unicode properties for a given code point.
-Besides this, all the Unicode character properties mentioned above
+Besides these, all the Unicode character properties mentioned above
(except for those marked as for internal use by Perl) are also
accessible by L<Unicode::UCD/prop_invlist()>.
=item *
+A new function L<charprop()|Unicode::UCD/charprops_all()>
+has been added to return the values of all Unicode properties for a
+given code point.
+
+=item *
+
A bug has been fixed so that L<propaliases()|Unicode::UCD/prop_aliases()>
returns the correct short and long names for the Perl extensions where
it was incorrect.