@@ -14,6 +14,19 @@ BEGIN {
14
14
use_ok(' version' , 0.9931);
15
15
}
16
16
17
+ sub radix { # Returns the radix character for the current locale.
18
+
19
+ # Use localeconv() on earlier perls; if it is just a stub, assume a dot.
20
+ if (! $^V or $^V lt v5.37.4) {
21
+ return localeconv()-> {decimal_point } || " ." ;
22
+ }
23
+
24
+ # localeconv() may be a stub on some platforms. But on later perls,
25
+ # langinfo() will always exist and returns the best available value.
26
+ use if $^V && $^V ge v5.37.4, ' I18N::Langinfo' => qw( langinfo RADIXCHAR) ;
27
+ return langinfo(RADIXCHAR);
28
+ }
29
+
17
30
SKIP: {
18
31
skip ' No locale testing for Perl < 5.6.0' , 7 if $] < 5.006;
19
32
skip ' No locale testing without d_setlocale' , 7
@@ -36,10 +49,10 @@ SKIP: {
36
49
while (<DATA >) {
37
50
chomp ;
38
51
$loc = setlocale( LC_ALL, $_ );
39
- last if $loc && localeconv() -> { decimal_point } eq ' ,' ;
52
+ last if $loc && radix() eq ' ,' ;
40
53
}
41
54
skip ' Cannot test locale handling without a comma locale' , 6
42
- unless $loc and localeconv() -> { decimal_point } eq ' ,' ;
55
+ unless $loc and radix() eq ' ,' ;
43
56
44
57
setlocale(LC_NUMERIC, $loc );
45
58
$ver = 1.23; # has to be floating point number
0 commit comments