From 6e1412916122065df4d09d22997d3f16a532ebed Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Fri, 1 May 2015 12:37:20 +0200 Subject: IRIS/Result: Remove set_tl logic -- turns out it's not required --- lib/Travel/Status/DE/IRIS.pm | 16 +++++----------- lib/Travel/Status/DE/IRIS/Result.pm | 10 +--------- 2 files changed, 6 insertions(+), 20 deletions(-) diff --git a/lib/Travel/Status/DE/IRIS.pm b/lib/Travel/Status/DE/IRIS.pm index 1178c4f..7cd8aec 100644 --- a/lib/Travel/Status/DE/IRIS.pm +++ b/lib/Travel/Status/DE/IRIS.pm @@ -224,7 +224,6 @@ sub get_realtime { for my $s ( $xml->findnodes('/timetable/s') ) { my $id = $s->getAttribute('id'); - my $e_tl = ( $s->findnodes('./tl') )[0]; my $e_ar = ( $s->findnodes('./ar') )[0]; my $e_dp = ( $s->findnodes('./dp') )[0]; my @e_refs = $s->findnodes('./ref/tl'); @@ -263,16 +262,11 @@ sub get_realtime { $result->set_messages(%messages); - if ($e_tl) { - $result->set_tl( - class => $e_tl->getAttribute('f'), # D N S F - unknown_t => $e_tl->getAttribute('t'), # p - train_no => $e_tl->getAttribute('n'), # dep number - type => $e_tl->getAttribute('c'), # S/ICE/ERB/... - line_no => $e_tl->getAttribute('l'), # 1 -> S1, ... - unknown_o => $e_tl->getAttribute('o'), # owner: 03/80/R2/... - ); - } + # note: A departure may also have a ./tl attribute. However, we do + # not need to process it because it only matters for departures which + # are not planned (or not in the plans we requested). However, in + # those cases we already called add_result earlier, which reads ./tl + # by itself. for my $e_ref (@e_refs) { $result->add_raw_ref( class => $e_ref->getAttribute('f'), # D N S F diff --git a/lib/Travel/Status/DE/IRIS/Result.pm b/lib/Travel/Status/DE/IRIS/Result.pm index bc3a61d..8d4d1c4 100644 --- a/lib/Travel/Status/DE/IRIS/Result.pm +++ b/lib/Travel/Status/DE/IRIS/Result.pm @@ -317,14 +317,6 @@ sub add_raw_ref { return $self; } -sub set_tl { - my ( $self, %attrib ) = @_; - - # TODO - - return $self; -} - sub set_unscheduled { my ( $self, $unscheduled ) = @_; @@ -732,7 +724,7 @@ sub TO_JSON { delete $copy{replaced_by}; delete $copy{replacement_for}; - return { %copy }; + return {%copy}; } 1; -- cgit v1.2.3