summaryrefslogtreecommitdiff
path: root/lib/Travel/Status/DE/IRIS
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2022-01-28 23:00:23 +0100
committerDaniel Friesel <derf@finalrewind.org>2022-01-28 23:00:23 +0100
commitd0f6ffdbfee3b594adf58ce8a83d0564e2181639 (patch)
treee2d287505f0f4d74372f07b8abc3fc448910d7a0 /lib/Travel/Status/DE/IRIS
parent37c0aa5bb513da2cb6de7f673e97bc5192384e06 (diff)
add "meta" dict (referenced / paired stations)
Diffstat (limited to 'lib/Travel/Status/DE/IRIS')
-rw-r--r--lib/Travel/Status/DE/IRIS/Stations.pm.PL21
1 files changed, 21 insertions, 0 deletions
diff --git a/lib/Travel/Status/DE/IRIS/Stations.pm.PL b/lib/Travel/Status/DE/IRIS/Stations.pm.PL
index 7608f0f..e56b91f 100644
--- a/lib/Travel/Status/DE/IRIS/Stations.pm.PL
+++ b/lib/Travel/Status/DE/IRIS/Stations.pm.PL
@@ -10,6 +10,9 @@ use JSON;
my $json_str = read_file('share/stations.json');
my $stations = JSON->new->utf8->decode($json_str);
+my $meta_str = read_file('share/meta.json');
+my $meta = JSON->new->utf8->decode($meta_str);
+
my $buf = <<'EOF';
package Travel::Status::DE::IRIS::Stations;
@@ -64,10 +67,28 @@ for my $station ( @{$stations} ) {
$buf .= <<'EOF';
);
+# Automatically generated, see share/meta.json
+my $meta = {
+EOF
+
+for my $eva (keys %{$meta}) {
+ $buf .= sprintf("%s => [%s],\n",
+ $eva,
+ join(q{,}, @{$meta->{$eva}})
+ );
+}
+
+$buf .= <<'EOF';
+};
+
sub get_stations {
return @stations;
}
+sub get_meta {
+ return $meta;
+}
+
sub normalize {
my ($val) = @_;