This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
utf8_heavy: Fail on binary/non- mismatch
authorKarl Williamson <public@khwilliamson.com>
Thu, 7 Jul 2011 23:42:09 +0000 (17:42 -0600)
committerKarl Williamson <public@khwilliamson.com>
Fri, 8 Jul 2011 00:02:09 +0000 (18:02 -0600)
If the user asks for a binary property, but passes a name that
is a non-binary property, fail.

lib/utf8_heavy.pl

index 569c336..3af9149 100644 (file)
@@ -421,6 +421,12 @@ sub croak { require Carp; Carp::croak(@_) }
                 ## is to use Unicode::UCD.
                 ##
                 if ($type =~ /^To(Digit|Fold|Lower|Title|Upper)$/) {
+
+                    # Fail if wanting a binary property, as these aren't.
+                    if ($minbits == 1) {
+                        pop @recursed if @recursed;
+                        return $type;
+                    }
                     $file = "$unicore_dir/To/$1.pl";
                     ## would like to test to see if $file actually exists....
                     last GETFILE;