From 08d0de73ca39d8bfc8fdb7c4bc89305aba578336 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Sat, 10 Oct 2015 12:33:56 +0200 Subject: add line_no / train_no accessors --- lib/Travel/Status/DE/HAFAS/Result.pm | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/lib/Travel/Status/DE/HAFAS/Result.pm b/lib/Travel/Status/DE/HAFAS/Result.pm index 99c320b..5048f35 100644 --- a/lib/Travel/Status/DE/HAFAS/Result.pm +++ b/lib/Travel/Status/DE/HAFAS/Result.pm @@ -109,6 +109,21 @@ sub type { return $type; } +sub line_no { + my ($self) = @_; + + # $self->{train} is either "TYPE 12345" or "TYPE12345" + my ($line_no) = ( $self->{train} =~ m{ ([^[:space:]]+) $ }x ); + + return $line_no; +} + +sub train_no { + my ($self) = @_; + + return $self->line_no; +} + 1; __END__ -- cgit v1.2.3