| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
|
|
2
|
|
|
|
|
|
|
use strict; |
|
3
|
15
|
|
|
15
|
|
88
|
use warnings; |
|
|
15
|
|
|
|
|
30
|
|
|
|
15
|
|
|
|
|
364
|
|
|
4
|
15
|
|
|
15
|
|
63
|
use namespace::autoclean 0.19 -except => ['import']; |
|
|
15
|
|
|
|
|
24
|
|
|
|
15
|
|
|
|
|
485
|
|
|
5
|
15
|
|
|
15
|
|
74
|
|
|
|
15
|
|
|
|
|
373
|
|
|
|
15
|
|
|
|
|
295
|
|
|
6
|
|
|
|
|
|
|
use Exporter qw( import ); |
|
7
|
15
|
|
|
15
|
|
1210
|
|
|
|
15
|
|
|
|
|
29
|
|
|
|
15
|
|
|
|
|
4893
|
|
|
8
|
|
|
|
|
|
|
our $VERSION = '1.37'; |
|
9
|
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
our @EXPORT_OK = 'parse_locale_code'; |
|
11
|
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
# It might be better to redo this as something that looks up each piece in a |
|
13
|
|
|
|
|
|
|
# catalog of codes. In particular, attempting to distinguish variants from |
|
14
|
|
|
|
|
|
|
# scripts is basically impossible without hard-coding (see 'tarask' below) or |
|
15
|
|
|
|
|
|
|
# by looking the codes up in a catalog. |
|
16
|
|
|
|
|
|
|
my @pieces = split /-/, $_[0]; |
|
17
|
|
|
|
|
|
|
|
|
18
|
11
|
|
|
11
|
0
|
78
|
return unless @pieces; |
|
19
|
|
|
|
|
|
|
|
|
20
|
11
|
50
|
|
|
|
31
|
my %codes = ( language => lc shift @pieces ); |
|
21
|
|
|
|
|
|
|
if ( @pieces == 1 ) { |
|
22
|
11
|
|
|
|
|
37
|
if ( length $pieces[0] == 2 || $pieces[0] =~ /^\d\d\d$/ ) { |
|
23
|
11
|
100
|
|
|
|
49
|
$codes{territory} = uc shift @pieces; |
|
|
|
50
|
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
24
|
6
|
100
|
66
|
|
|
29
|
} |
|
|
|
50
|
|
|
|
|
|
|
25
|
5
|
|
|
|
|
23
|
|
|
26
|
|
|
|
|
|
|
# The "be-Tarask" locale appears to be the only locale with a variant |
|
27
|
|
|
|
|
|
|
# and no territory or script. |
|
28
|
|
|
|
|
|
|
elsif ( lc $pieces[0] eq 'tarask' ) { |
|
29
|
|
|
|
|
|
|
$codes{variant} = uc shift @pieces; |
|
30
|
|
|
|
|
|
|
} |
|
31
|
0
|
|
|
|
|
0
|
else { |
|
32
|
|
|
|
|
|
|
$codes{script} = _tc( shift @pieces ); |
|
33
|
|
|
|
|
|
|
} |
|
34
|
1
|
|
|
|
|
4
|
} |
|
35
|
|
|
|
|
|
|
elsif ( @pieces == 3 ) { |
|
36
|
|
|
|
|
|
|
$codes{script} = _tc( shift @pieces ); |
|
37
|
|
|
|
|
|
|
$codes{territory} = uc shift @pieces; |
|
38
|
0
|
|
|
|
|
0
|
$codes{variant} = uc shift @pieces; |
|
39
|
0
|
|
|
|
|
0
|
} |
|
40
|
0
|
|
|
|
|
0
|
elsif ( @pieces == 2 ) { |
|
41
|
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
# I don't think it's possible to have a script + variant without also |
|
43
|
|
|
|
|
|
|
# having a territory. |
|
44
|
|
|
|
|
|
|
if ( length $pieces[1] == 2 || $pieces[1] =~ /^\d\d\d$/ ) { |
|
45
|
|
|
|
|
|
|
$codes{script} = _tc( shift @pieces ); |
|
46
|
2
|
50
|
33
|
|
|
10
|
$codes{territory} = uc shift @pieces; |
|
47
|
2
|
|
|
|
|
7
|
} |
|
48
|
2
|
|
|
|
|
7
|
else { |
|
49
|
|
|
|
|
|
|
$codes{territory} = uc shift @pieces; |
|
50
|
|
|
|
|
|
|
$codes{variant} = uc shift @pieces; |
|
51
|
0
|
|
|
|
|
0
|
} |
|
52
|
0
|
|
|
|
|
0
|
} |
|
53
|
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
return %codes; |
|
55
|
|
|
|
|
|
|
} |
|
56
|
11
|
|
|
|
|
65
|
|
|
57
|
|
|
|
|
|
|
return ucfirst lc $_[0]; |
|
58
|
|
|
|
|
|
|
} |
|
59
|
|
|
|
|
|
|
|
|
60
|
3
|
|
|
3
|
|
11
|
1; |
|
61
|
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
# ABSTRACT: Utility code for DateTime::Locale |
|
63
|
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
=pod |
|
66
|
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
=encoding UTF-8 |
|
68
|
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
=head1 NAME |
|
70
|
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
DateTime::Locale::Util - Utility code for DateTime::Locale |
|
72
|
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
=head1 VERSION |
|
74
|
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
version 1.37 |
|
76
|
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
78
|
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
There are no user-facing parts in this module. |
|
80
|
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
=head1 SUPPORT |
|
82
|
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
Bugs may be submitted at L<https://github.com/houseabsolute/DateTime-Locale/issues>. |
|
84
|
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
There is a mailing list available for users of this distribution, |
|
86
|
|
|
|
|
|
|
L<mailto:datetime@perl.org>. |
|
87
|
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
=head1 SOURCE |
|
89
|
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
The source code repository for DateTime-Locale can be found at L<https://github.com/houseabsolute/DateTime-Locale>. |
|
91
|
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
=head1 AUTHOR |
|
93
|
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
Dave Rolsky <autarch@urth.org> |
|
95
|
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
|
97
|
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
This software is copyright (c) 2003 - 2022 by Dave Rolsky. |
|
99
|
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
|
101
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
|
102
|
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
The full text of the license can be found in the |
|
104
|
|
|
|
|
|
|
F<LICENSE> file included with this distribution. |
|
105
|
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
=cut |