From f4c810aedc5679e68fb6861751b1732b1e43907d Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Sun, 30 Jan 2022 17:46:27 +0100 Subject: IRIS(3pm): new and new_p also accept station names --- lib/Travel/Status/DE/IRIS.pm | 13 ++----------- 1 file 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 { -- cgit v1.2.3