diff options
-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 = { |