line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Emoji::NationalFlag; |
2
|
1
|
|
|
1
|
|
61005
|
use strict; |
|
1
|
|
|
|
|
19
|
|
|
1
|
|
|
|
|
41
|
|
3
|
1
|
|
|
1
|
|
9
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
64
|
|
4
|
|
|
|
|
|
|
our $VERSION = '0.01'; |
5
|
1
|
|
|
1
|
|
448
|
use Locale::Country 'all_country_codes'; |
|
1
|
|
|
|
|
38314
|
|
|
1
|
|
|
|
|
81
|
|
6
|
|
|
|
|
|
|
|
7
|
1
|
|
|
1
|
|
9
|
use Exporter 'import'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
256
|
|
8
|
|
|
|
|
|
|
our @EXPORT_OK = qw( |
9
|
|
|
|
|
|
|
code2flag |
10
|
|
|
|
|
|
|
flag2code |
11
|
|
|
|
|
|
|
); |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
our %A2SYM = map { (chr 0x61 + $_) => (pack U => 0x1f1e6 + $_) } 0 .. 25; |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
our %FLAG2CODE |
16
|
|
|
|
|
|
|
= reverse our %CODE2FLAG |
17
|
|
|
|
|
|
|
= map { $_ => join "", map { $A2SYM{$_} } split //, $_ } map { lc($_) } all_country_codes(); |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
sub code2flag { |
20
|
251
|
|
|
251
|
1
|
178927
|
my ($code) = @_; |
21
|
251
|
50
|
50
|
|
|
1326
|
if (defined(my $flag = $CODE2FLAG{lc($code // '')})) { |
22
|
251
|
|
|
|
|
833
|
return $flag; |
23
|
|
|
|
|
|
|
} |
24
|
0
|
|
|
|
|
0
|
return; |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
sub flag2code { |
28
|
252
|
|
|
252
|
1
|
3580
|
my ($flag) = @_; |
29
|
252
|
100
|
50
|
|
|
1112
|
if (defined(my $code = $FLAG2CODE{$flag // ''})) { |
30
|
251
|
|
|
|
|
972
|
return lc $code; |
31
|
|
|
|
|
|
|
} |
32
|
1
|
|
|
|
|
6
|
return; |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
1; |
36
|
|
|
|
|
|
|
__END__ |