From a58a9a6c73057275e1b05e4196110864d6146e51 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Thu, 7 May 2015 21:55:42 +0200 Subject: Result: Add is_cancelled accessor --- lib/Travel/Status/DE/DeutscheBahn/Result.pm | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'lib/Travel/Status') diff --git a/lib/Travel/Status/DE/DeutscheBahn/Result.pm b/lib/Travel/Status/DE/DeutscheBahn/Result.pm index ca61194..6eb7450 100644 --- a/lib/Travel/Status/DE/DeutscheBahn/Result.pm +++ b/lib/Travel/Status/DE/DeutscheBahn/Result.pm @@ -62,6 +62,16 @@ sub delay { return; } +sub is_cancelled { + my ($self) = @_; + my $info = $self->info_raw; + + if ( $info =~ m{ Fahrt \s f.llt \s aus }ox ) { + return 1; + } + return 0; +} + sub origin { my ($self) = @_; @@ -207,6 +217,10 @@ Returns the train's delay in minutes, or undef if it is unknown. Returns additional information, for instance the reason why the train is delayed. May be an empty string if no (useful) information is available. +=item $result->is_cancelled + +True if the train was cancelled, false otherwise. + =item $result->line =item $result->train -- cgit v1.2.3