line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Mo::utils::Language; |
2
|
|
|
|
|
|
|
|
3
|
3
|
|
|
3
|
|
85829
|
use base qw(Exporter); |
|
3
|
|
|
|
|
17
|
|
|
3
|
|
|
|
|
376
|
|
4
|
3
|
|
|
3
|
|
20
|
use strict; |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
59
|
|
5
|
3
|
|
|
3
|
|
22
|
use warnings; |
|
3
|
|
|
|
|
8
|
|
|
3
|
|
|
|
|
184
|
|
6
|
|
|
|
|
|
|
|
7
|
3
|
|
|
3
|
|
1397
|
use Error::Pure qw(err); |
|
3
|
|
|
|
|
24705
|
|
|
3
|
|
|
|
|
71
|
|
8
|
3
|
|
|
3
|
|
225
|
use List::Util qw(none); |
|
3
|
|
|
|
|
7
|
|
|
3
|
|
|
|
|
359
|
|
9
|
3
|
|
|
3
|
|
1443
|
use Locale::Language; |
|
3
|
|
|
|
|
645670
|
|
|
3
|
|
|
|
|
460
|
|
10
|
3
|
|
|
3
|
|
29
|
use Readonly; |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
760
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
Readonly::Array our @EXPORT_OK => qw(check_language); |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
our $VERSION = 0.02; |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
sub check_language { |
17
|
5
|
|
|
5
|
1
|
4601
|
my ($self, $key) = @_; |
18
|
|
|
|
|
|
|
|
19
|
5
|
100
|
|
|
|
13
|
_check_key($self, $key) && return; |
20
|
|
|
|
|
|
|
|
21
|
3
|
100
|
|
408
|
|
21
|
if (none { $_ eq $self->{$key} } all_language_codes()) { |
|
408
|
|
|
|
|
935
|
|
22
|
2
|
|
|
|
|
13
|
err "Language code '".$self->{$key}."' isn't ISO 639-1 code."; |
23
|
|
|
|
|
|
|
} |
24
|
|
|
|
|
|
|
|
25
|
1
|
|
|
|
|
10
|
return; |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
sub _check_key { |
29
|
5
|
|
|
5
|
|
11
|
my ($self, $key) = @_; |
30
|
|
|
|
|
|
|
|
31
|
5
|
100
|
100
|
|
|
29
|
if (! exists $self->{$key} || ! defined $self->{$key}) { |
32
|
2
|
|
|
|
|
7
|
return 1; |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
3
|
|
|
|
|
10
|
return 0; |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
1; |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
__END__ |