summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2022-01-30 17:46:27 +0100
committerDaniel Friesel <derf@finalrewind.org>2022-01-30 17:48:49 +0100
commitf4c810aedc5679e68fb6861751b1732b1e43907d (patch)
treecfddbc6aca15e1b6c5b37c16a7d40587e9d183a2
parent086e9d2e9cc4ec743248fb08ddeed688dc8a9129 (diff)
IRIS(3pm): new and new_p also accept station names
-rw-r--r--lib/Travel/Status/DE/IRIS.pm13
1 files changed, 2 insertions, 11 deletions
diff --git a/lib/Travel/Status/DE/IRIS.pm b/lib/Travel/Status/DE/IRIS.pm
index 7bd180b..8f6e461 100644
--- a/lib/Travel/Status/DE/IRIS.pm
+++ b/lib/Travel/Status/DE/IRIS.pm
@@ -931,13 +931,8 @@ Travel::Status::DE::IRIS - Interface to IRIS based web departure monitors.
Blocking variant:
use Travel::Status::DE::IRIS;
- use Travel::Status::DE::IRIS::Stations;
-
- # Get station code for "Essen Hbf" (-> "EE")
- my $station = (Travel::Status::DE::IRIS::Stations::get_station_by_name(
- 'Essen Hbf'))[0][0];
- my $status = Travel::Status::DE::IRIS->new(station => $station);
+ my $status = Travel::Status::DE::IRIS->new(station => "Essen Hbf");
for my $r ($status->results) {
printf(
"%s %s +%-3d %10s -> %s\n",
@@ -951,12 +946,8 @@ Non-blocking variant:
use Mojo::UserAgent;
use Travel::Status::DE::IRIS;
use Travel::Status::DE::IRIS::Stations;
-
- # Get station code for "Essen Hbf" (-> "EE")
- my $station = (Travel::Status::DE::IRIS::Stations::get_station_by_name(
- 'Essen Hbf'))[0][0];
- Travel::Status::DE::IRIS->new_p(station => $station,
+ Travel::Status::DE::IRIS->new_p(station => "Essen Hbf",
promise => 'Mojo::Promise', user_agent => Mojo::UserAgent->new,
get_station => \&Travel::Status::DE::IRIS::Stations::get_station,
meta => Travel::Status::DE::IRIS::Stations::get_meta())->then(sub {