summaryrefslogtreecommitdiff
path: root/lib/Travel/Status/DE/IRIS
diff options
context:
space:
mode:
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) = @_;