diff options
author | Daniel Friesel <derf@finalrewind.org> | 2013-10-16 18:32:50 +0200 |
---|---|---|
committer | Daniel Friesel <derf@finalrewind.org> | 2013-10-16 18:32:50 +0200 |
commit | 565b081d49fee46f8ffd830057b1939286f3551b (patch) | |
tree | 879c22b20acb19f3e0bc772fc835758a4d4f854e /lib | |
parent | 585a0f6f476ec04f19e2924dbbcbd898343cc867 (diff) |
add $result->is_cancelled accessor, do not allow delay == -9999
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Travel/Status/DE/VRR/Result.pm | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/lib/Travel/Status/DE/VRR/Result.pm b/lib/Travel/Status/DE/VRR/Result.pm index e1ebee5..0468115 100644 --- a/lib/Travel/Status/DE/VRR/Result.pm +++ b/lib/Travel/Status/DE/VRR/Result.pm @@ -9,7 +9,7 @@ use parent 'Class::Accessor'; our $VERSION = '1.03'; Travel::Status::DE::VRR::Result->mk_ro_accessors( - qw(countdown date delay destination info key line lineref platform + qw(countdown date delay destination is_cancelled info key line lineref platform platform_db sched_date sched_time time type) ); @@ -18,6 +18,14 @@ sub new { my $ref = \%conf; + if ($ref->{delay} eq '-9999') { + $ref->{delay} = 0; + $ref->{is_cancelled} = 1; + } + else { + $ref->{is_cancelled} = 0; + } + return bless( $ref, $obj ); } @@ -77,10 +85,8 @@ Actual departure date (DD.MM.YYYY). =item $departure->delay -Expected delay from scheduled departure time in minutes. - -Note that this is only available for DB trains, in other cases it will always -return 0. +Expected delay from scheduled departure time in minutes. A delay of 0 +indicates either departure on time or that no delay information is available. =item $departure->destination @@ -93,6 +99,10 @@ an address were requested, this is the stop name, otherwise it may be recent news related to the line's schedule. If no information is available, returns an empty string. +=item $departure->is_cancelled + +1 if the departure got cancelled, 0 otherwise. + =item $departure->key Unknown. Unlike the name may suggest, this is not a unique key / UUID for a |