Skip to content

Commit

Permalink
t/ascii_order.pl: Don't crash on early Perl EBCDICs
Browse files Browse the repository at this point in the history
These would otherwise call an undefined function.  Just return instead
of doing that, which leads to incorrect results, but it's better than
crashing.
  • Loading branch information
khwilliamson committed Feb 8, 2015
1 parent 9eb5dc8 commit 7e9f309
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion t/ascii_order.pl
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ ($)
# (which is the same as ASCII)
my $string = shift;

return $string if ord("A") == 65;
return $string if ord("A") == 65
|| $] lt 5.007_003; # Doesn't work on early EBCDIC Perls
my $output = "";
for my $i (0 .. length($string) - 1) {
$output .= chr(utf8::native_to_unicode(ord(substr($string, $i, 1))));
Expand Down

0 comments on commit 7e9f309

Please sign in to comment.