diff options
author | Daniel Friesel <derf@finalrewind.org> | 2014-01-11 22:50:11 +0100 |
---|---|---|
committer | Daniel Friesel <derf@finalrewind.org> | 2014-01-11 22:50:11 +0100 |
commit | ef58e86cd740064057186f9a5732f6a62b68bcf1 (patch) | |
tree | 40c537fd11d725b92058a4ad1c9e0d29bb6d6241 /lib/Travel | |
parent | 1d739bfbf784f20ec1dd7706f17268c61cdb2ede (diff) |
db-iris: implement -om
Diffstat (limited to 'lib/Travel')
-rw-r--r-- | lib/Travel/Status/DE/IRIS/Result.pm | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/lib/Travel/Status/DE/IRIS/Result.pm b/lib/Travel/Status/DE/IRIS/Result.pm index 4eb3096..c3dd8aa 100644 --- a/lib/Travel/Status/DE/IRIS/Result.pm +++ b/lib/Travel/Status/DE/IRIS/Result.pm @@ -173,6 +173,22 @@ sub destination { return $self->route_end; } +sub messages { + my ($self) = @_; + + my $strp = DateTime::Format::Strptime->new( + pattern => '%y%m%d%H%M', + time_zone => 'Europe/Berlin', + ); + + my @messages = sort keys %{ $self->{messages } }; + my @ret = map { [ $strp->parse_datetime($self->{messages}->{$_}->[0]), + $self->translate_msg($self->{messages}->{$_}->[2]) ] } + @messages; + + return @ret; +} + sub info { my ($self) = @_; @@ -460,6 +476,14 @@ usually do not have this field set, even if they have a common line number Example: For the line C<< S 1 >>, line_no will return C<< 1 >>. +=item $result->messages + +Get all qos and delay messages ever entered for this train. Returns a list +of [datetime, string] listrefs. The datetime part is a DateTime(3pm) object +corresponding to the point in time when the message was entered, the string +is the message. Note that neither duplicates nor superseded messages are +filtered from this list. + =item $result->origin Alias for route_start. |