diff options
author | Daniel Friesel <derf@finalrewind.org> | 2015-10-10 12:33:56 +0200 |
---|---|---|
committer | Daniel Friesel <derf@finalrewind.org> | 2015-10-10 12:33:56 +0200 |
commit | 08d0de73ca39d8bfc8fdb7c4bc89305aba578336 (patch) | |
tree | b5cfe7ccb75721e3eb408de9b1d04803ec0bf943 | |
parent | c8044c760d26298155d5aee3c1ad8ca993b647d2 (diff) |
add line_no / train_no accessors
-rw-r--r-- | lib/Travel/Status/DE/HAFAS/Result.pm | 15 |
1 files changed, 15 insertions, 0 deletions
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__ |