diff options
author | Daniel Friesel <derf@finalrewind.org> | 2015-09-24 20:29:58 +0200 |
---|---|---|
committer | Daniel Friesel <derf@finalrewind.org> | 2015-09-24 20:29:58 +0200 |
commit | 8ab29ec6ac3be4d96aec1ebc55ad4d77a105d05e (patch) | |
tree | dd79732ad28cfd49b922c376561f97fd3905a265 /lib | |
parent | af194f0bc93b52d91694dc11fc837215c6be8e7e (diff) |
turns out delayReason holds more data than anticipated
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Travel/Status/DE/HAFAS.pm | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/lib/Travel/Status/DE/HAFAS.pm b/lib/Travel/Status/DE/HAFAS.pm index 12bc08f..0e588fc 100644 --- a/lib/Travel/Status/DE/HAFAS.pm +++ b/lib/Travel/Status/DE/HAFAS.pm @@ -253,9 +253,9 @@ sub similar_stops { if ( $service and exists $hafas_instance{$service}{stopfinder} ) { my $sf = Travel::Status::DE::HAFAS::StopFinder->new( - url => $hafas_instance{$service}{stopfinder}, - input => $self->{station}, - ua => $self->{ua}, + url => $hafas_instance{$service}{stopfinder}, + input => $self->{station}, + ua => $self->{ua}, developer_mode => $self->{developer_mode}, ); if ( my $err = $sf->errstr ) { @@ -307,10 +307,16 @@ sub results { substr( $date, 6, 0, '20' ); - # delayReason=" " means no delay reason - if ( $info eq q{ } ) { + # TODO the first charactor of delayReason is special: + # " " -> no additional data, rest (if any) is delay reason + # else -> first word is not a delay reason but additional data, + # for instance "Zusatzfahrt/Ersatzfahrt" for a replacement train + if ( $info and $info eq q{ } ) { $info = undef; } + elsif ( substr( $info, 0, 1 ) eq q{ } ) { + substr( $info, 0, 1, q{} ); + } $train =~ s{#.*$}{}; |