diff options
author | Daniel Friesel <derf@finalrewind.org> | 2016-12-13 14:11:37 +0100 |
---|---|---|
committer | Daniel Friesel <derf@finalrewind.org> | 2016-12-13 14:11:37 +0100 |
commit | 49197e9b490f2e2da4747b28889defdb4b87451d (patch) | |
tree | fe0192a04da56d679459babe9121613b676fa098 /lib/Travel/Status | |
parent | 059789620c0ffaa8f69d59a3137a10e342ead366 (diff) |
line no calculation: Don't get confused by 3- or 4-digit train numbers
Diffstat (limited to 'lib/Travel/Status')
-rw-r--r-- | lib/Travel/Status/DE/IRIS/Result.pm | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/Travel/Status/DE/IRIS/Result.pm b/lib/Travel/Status/DE/IRIS/Result.pm index 847682f..5a4247c 100644 --- a/lib/Travel/Status/DE/IRIS/Result.pm +++ b/lib/Travel/Status/DE/IRIS/Result.pm @@ -202,8 +202,8 @@ sub new { $ref->{is_cancelled} = 0; - if ( not defined $ref->{line_no} ) { - my $train_prefix = substr( $ref->{train_no}, 0, 3 ); + if ( not defined $ref->{line_no} and length( $ref->{train_no} ) > 2 ) { + my $train_prefix = substr( $ref->{train_no}, -5, 3 ); $ref->{line_no} = $linemap{ $ref->{type} }{$train_prefix}; } |