This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
t/test.pl: Simplify ord to/from native fcns
authorKarl Williamson <public@khwilliamson.com>
Sun, 24 Feb 2013 23:05:55 +0000 (16:05 -0700)
committerKarl Williamson <public@khwilliamson.com>
Thu, 29 Aug 2013 15:55:55 +0000 (09:55 -0600)
This commit changes these functions from converting to/from a string to
calling functions which operate on ordinals instead that are in the
utf8:: namespace.

t/test.pl

index 576df92..e918a42 100644 (file)
--- a/t/test.pl
+++ b/t/test.pl
@@ -1728,8 +1728,8 @@ sub ord_latin1_to_native {
     # equivalent value.  Anything above latin1 is itself.
 
     my $ord = shift;
     # equivalent value.  Anything above latin1 is itself.
 
     my $ord = shift;
-    return $ord if $ord > 255;
-    return ord latin1_to_native(chr $ord);
+    return $ord if ord('^') == 94;   # ASCII, Latin1
+    return utf8::unicode_to_native($ord);
 }
 
 sub ord_native_to_latin1 {
 }
 
 sub ord_native_to_latin1 {
@@ -1737,8 +1737,8 @@ sub ord_native_to_latin1 {
     # Anything above latin1 is itself.
 
     my $ord = shift;
     # Anything above latin1 is itself.
 
     my $ord = shift;
-    return $ord if $ord > 255;
-    return ord native_to_latin1(chr $ord);
+    return $ord if ord('^') == 94;   # ASCII, Latin1
+    return utf8::native_to_unicode($ord);
 }
 
 1;
 }
 
 1;