strict;
use warnings;
use JSON 'decode_json';
use Path::Class 'file';
use Exporter 'import';
our @EXPORT_OK = qw(get_un);
sub get_un {
my $fn = sprintf "%s/%04d.json", data_dir(), shift;
retu
rn unless -e $fn;
open my $fh, '<', $fn;
my $text = <$fh>;
my $hashref = decode_json $text or return;
return %$hashref;
}
sub data_dir {
file(__FILE__)->parent()->subdir('UN-data');
}
1;