summaryrefslogtreecommitdiff
path: root/lib/Travel/Status/DE/IRIS
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2014-01-15 11:04:37 +0100
committerDaniel Friesel <derf@finalrewind.org>2014-01-15 11:04:37 +0100
commita84a29cee9427191096b1c4753843e79e200f8d9 (patch)
tree2439707e4a1759cf54dc946143e33a7d00f05bf4 /lib/Travel/Status/DE/IRIS
parent2ecfc2cfd6015729608df339f14e4a2e520a6696 (diff)
Stations: Move DS100 match to separate method, use this for db-iris
Diffstat (limited to 'lib/Travel/Status/DE/IRIS')
-rw-r--r--lib/Travel/Status/DE/IRIS/Stations.pm22
1 files changed, 22 insertions, 0 deletions
diff --git a/lib/Travel/Status/DE/IRIS/Stations.pm b/lib/Travel/Status/DE/IRIS/Stations.pm
index 3f05fd9..27261a0 100644
--- a/lib/Travel/Status/DE/IRIS/Stations.pm
+++ b/lib/Travel/Status/DE/IRIS/Stations.pm
@@ -15100,6 +15100,18 @@ sub get_stations {
return @stations;
}
+sub get_station {
+ my ( $name ) = @_;
+
+ my $ds100_match = firstval { $name eq $_->[0] } @stations;
+
+ if ($ds100_match) {
+ return ($ds100_match);
+ }
+
+ return get_station_by_name($name);
+}
+
sub get_station_by_name {
my ( $name ) = @_;
@@ -15165,6 +15177,16 @@ B<Note:> Station codes may contain whitespace.
Returns a list of [station code, station name] listrefs lexically sorted by
station name.
+=item Travel::Status::DE::IRIS::get_station(I<$in>)
+
+Returns a list of [station code, station name] listrefs matching I<$in>.
+
+If a I<$in> is a valid station code, only one element ([I<$in>, related name])
+is returned. Otherwise, it is passed to get_station_by_name(I<$in>) (see
+below).
+
+Note that station codes matching is case sensitive and must be exact.
+
=item Travel::Status::DE::IRIS::get_station_by_name(I<$name>)
Returns a list of [station code, station name] listrefs where the station