| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
1
|
|
|
1
|
|
309646
|
use strictures; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
6
|
|
|
2
|
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
package Number::Format::FixedLocale; |
|
4
|
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
our $VERSION = '1.121780'; # VERSION |
|
6
|
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
# ABSTRACT: a Number::Format that ignores the system locale |
|
8
|
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
# |
|
10
|
|
|
|
|
|
|
# This file is part of Number-Format-FixedLocale |
|
11
|
|
|
|
|
|
|
# |
|
12
|
|
|
|
|
|
|
# |
|
13
|
|
|
|
|
|
|
# Christian Walde has dedicated the work to the Commons by waiving all of his |
|
14
|
|
|
|
|
|
|
# or her rights to the work worldwide under copyright law and all related or |
|
15
|
|
|
|
|
|
|
# neighboring legal rights he or she had in the work, to the extent allowable by |
|
16
|
|
|
|
|
|
|
# law. |
|
17
|
|
|
|
|
|
|
# |
|
18
|
|
|
|
|
|
|
# Works under CC0 do not require attribution. When citing the work, you should |
|
19
|
|
|
|
|
|
|
# not imply endorsement by the author. |
|
20
|
|
|
|
|
|
|
# |
|
21
|
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
|
|
23
|
1
|
|
|
1
|
|
175
|
use base 'Number::Format'; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
6945
|
|
|
24
|
|
|
|
|
|
|
|
|
25
|
1
|
|
|
1
|
|
16874
|
use Carp 'croak'; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
262
|
|
|
26
|
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
sub new |
|
28
|
|
|
|
|
|
|
{ |
|
29
|
3
|
|
|
3
|
1
|
32323
|
my $type = shift; |
|
30
|
3
|
|
|
|
|
14
|
my %args = @_; |
|
31
|
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
# Fetch defaults from current locale, or failing that, using globals |
|
33
|
3
|
|
|
|
|
7
|
my $me = {}; |
|
34
|
|
|
|
|
|
|
|
|
35
|
3
|
|
|
|
|
5
|
my $arg; |
|
36
|
|
|
|
|
|
|
|
|
37
|
3
|
|
|
|
|
22
|
while(my($arg, $default) = each %$Number::Format::DEFAULT_LOCALE) |
|
38
|
|
|
|
|
|
|
{ |
|
39
|
81
|
|
|
|
|
157
|
$me->{$arg} = $default; |
|
40
|
|
|
|
|
|
|
|
|
41
|
81
|
|
|
|
|
163
|
foreach ($arg, uc $arg, "-$arg", uc "-$arg") |
|
42
|
|
|
|
|
|
|
{ |
|
43
|
314
|
100
|
|
|
|
1215
|
next unless defined $args{$_}; |
|
44
|
10
|
|
|
|
|
19
|
$me->{$arg} = $args{$_}; |
|
45
|
10
|
|
|
|
|
16
|
delete $args{$_}; |
|
46
|
10
|
|
|
|
|
34
|
last; |
|
47
|
|
|
|
|
|
|
} |
|
48
|
|
|
|
|
|
|
} |
|
49
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
# |
|
51
|
|
|
|
|
|
|
# Some broken locales define the decimal_point but not the |
|
52
|
|
|
|
|
|
|
# thousands_sep. If decimal_point is set to "," the default |
|
53
|
|
|
|
|
|
|
# thousands_sep will be a conflict. In that case, set |
|
54
|
|
|
|
|
|
|
# thousands_sep to empty string. Suggested by Moritz Onken. |
|
55
|
|
|
|
|
|
|
# |
|
56
|
3
|
|
|
|
|
8
|
foreach my $prefix ("", "mon_") |
|
57
|
|
|
|
|
|
|
{ |
|
58
|
6
|
50
|
|
|
|
30
|
$me->{"${prefix}thousands_sep"} = "" |
|
59
|
|
|
|
|
|
|
if ($me->{"${prefix}decimal_point"} eq |
|
60
|
|
|
|
|
|
|
$me->{"${prefix}thousands_sep"}); |
|
61
|
|
|
|
|
|
|
} |
|
62
|
|
|
|
|
|
|
|
|
63
|
3
|
50
|
|
|
|
9
|
croak "Invalid argument(s)" if %args; |
|
64
|
3
|
|
|
|
|
10
|
bless $me, $type; |
|
65
|
3
|
|
|
|
|
20
|
$me; |
|
66
|
|
|
|
|
|
|
} |
|
67
|
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
1; |
|
69
|
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
__END__ |