line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Number::UN; |
2
|
|
|
|
|
|
|
{ |
3
|
|
|
|
|
|
|
$Number::UN::VERSION = '0.003'; |
4
|
|
|
|
|
|
|
} |
5
|
|
|
|
|
|
|
# ABSTRACT: details about UN numbers |
6
|
|
|
|
|
|
|
|
7
|
1
|
|
|
1
|
|
25103
|
use strict; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
42
|
|
8
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
31
|
|
9
|
|
|
|
|
|
|
|
10
|
1
|
|
|
1
|
|
1260
|
use JSON 'decode_json'; |
|
1
|
|
|
|
|
17839
|
|
|
1
|
|
|
|
|
7
|
|
11
|
1
|
|
|
1
|
|
1201
|
use Path::Class 'file'; |
|
1
|
|
|
|
|
99106
|
|
|
1
|
|
|
|
|
93
|
|
12
|
|
|
|
|
|
|
|
13
|
1
|
|
|
1
|
|
11
|
use Exporter 'import'; |
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
378
|
|
14
|
|
|
|
|
|
|
our @EXPORT_OK = qw(get_un); |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
sub get_un { |
18
|
3
|
|
|
3
|
0
|
10317
|
my $fn = sprintf "%s/%04d.json", data_dir(), shift; |
19
|
3
|
100
|
|
|
|
2029
|
return unless -e $fn; |
20
|
2
|
|
|
|
|
128
|
open my $fh, '<', $fn; |
21
|
2
|
|
|
|
|
56
|
my $text = <$fh>; |
22
|
2
|
50
|
|
|
|
37
|
my $hashref = decode_json $text or return; |
23
|
2
|
|
|
|
|
68
|
return %$hashref; |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
sub data_dir { |
27
|
3
|
|
|
3
|
0
|
18
|
file(__FILE__)->parent()->subdir('UN-data'); |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
1; |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
__END__ |