diff options
author | Birte Kristina Friesel <derf@finalrewind.org> | 2025-09-14 21:28:44 +0200 |
---|---|---|
committer | Birte Kristina Friesel <derf@finalrewind.org> | 2025-09-14 21:28:44 +0200 |
commit | 51a2b02fe0e4269314ae697bf4705d8ab138e87f (patch) | |
tree | aa58a5a77ce054792e46508318c1b42e8870673d | |
parent | 9c41c92069f1b8f2b3cfc59442e835cff9cdf67a (diff) |
Thu subsequent $hafas_instance->{$service}{...} checks create
$hafas_instance->{$service}, so at that point checking for it is moot.
-rw-r--r-- | lib/Travel/Status/DE/HAFAS.pm | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/Travel/Status/DE/HAFAS.pm b/lib/Travel/Status/DE/HAFAS.pm index 4d20270..83ad45b 100644 --- a/lib/Travel/Status/DE/HAFAS.pm +++ b/lib/Travel/Status/DE/HAFAS.pm @@ -41,6 +41,10 @@ sub new { my $ua = $conf{user_agent}; + if ( defined $service and not exists $hafas_instance->{$service} ) { + confess("The service '$service' is not supported"); + } + if ( not $ua ) { my %lwp_options = %{ $conf{lwp_options} // { timeout => 10 } }; if ( $service and $hafas_instance->{$service}{ua_string} ) { @@ -79,10 +83,6 @@ sub new { confess("You must specify a service"); } - if ( defined $service and not exists $hafas_instance->{$service} ) { - confess("The service '$service' is not supported"); - } - my $now = DateTime->now( time_zone => $hafas_instance->{$service}{time_zone} // 'Europe/Berlin' ); my $self = { |