diff options
author | Birte Kristina Friesel <derf@finalrewind.org> | 2025-03-23 09:24:18 +0100 |
---|---|---|
committer | Birte Kristina Friesel <derf@finalrewind.org> | 2025-03-23 09:24:18 +0100 |
commit | f87220cf402c398dc9b97bf42d120418e12fafc9 (patch) | |
tree | 647b3b6ddbe07eff1d3ff8ec0da7dd267b0461bd /lib/Travel | |
parent | 41153346f957a5ec43c43f45bfe01b50857aca14 (diff) |
Journey: Add type and number accessors
Diffstat (limited to 'lib/Travel')
-rw-r--r-- | lib/Travel/Status/DE/DBRIS/Journey.pm | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/Travel/Status/DE/DBRIS/Journey.pm b/lib/Travel/Status/DE/DBRIS/Journey.pm index d993b88..2b92341 100644 --- a/lib/Travel/Status/DE/DBRIS/Journey.pm +++ b/lib/Travel/Status/DE/DBRIS/Journey.pm @@ -10,7 +10,8 @@ use Travel::Status::DE::DBRIS::Location; our $VERSION = '0.06'; -Travel::Status::DE::DBRIS::Journey->mk_ro_accessors(qw(day train is_cancelled)); +Travel::Status::DE::DBRIS::Journey->mk_ro_accessors( + qw(day train type number is_cancelled)); sub new { my ( $obj, %opt ) = @_; @@ -28,6 +29,10 @@ sub new { strptime_obj => $strptime, }; + # Number is either train no (ICE, RE) or line no (S, U, Bus, ...) + # with no way of distinguishing between those + ( $ref->{type}, $ref->{number} ) = split( qr{\s+}, $ref->{train} ); + bless( $ref, $obj ); for my $message ( @{ $json->{himMeldungen} // [] } ) { |