From 5b9aa75d735b4ad27ea099cb8589360b62c31980 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Sat, 29 Oct 2022 10:44:55 +0200 Subject: Journey: add class accessor --- lib/Travel/Status/DE/HAFAS/Journey.pm | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/Travel/Status/DE/HAFAS/Journey.pm b/lib/Travel/Status/DE/HAFAS/Journey.pm index fba55cd..796afc5 100644 --- a/lib/Travel/Status/DE/HAFAS/Journey.pm +++ b/lib/Travel/Status/DE/HAFAS/Journey.pm @@ -16,7 +16,7 @@ Travel::Status::DE::HAFAS::Journey->mk_ro_accessors( qw(datetime sched_datetime rt_datetime is_cancelled is_partially_cancelled platform sched_platform rt_platform operator - id name type type_long number line load delay + id name type type_long class number line load delay route_end route_start origin destination direction) ); @@ -86,6 +86,8 @@ sub new { } } + my $class = $product->{cls}; + my @stops; for my $stop ( @{ $journey->{stopL} // [] } ) { my $loc = $locL[ $stop->{locX} ]; @@ -169,6 +171,7 @@ sub new { line => $line_no, type => $cat, type_long => $catlong, + class => $class, operator => $operator, direction => $direction, is_cancelled => $is_cancelled, @@ -379,6 +382,12 @@ or "STR" for tram / StraEenbahn. Returns the long type of this journey, e.g. "S-Bahn" or "Regional-Express". +=item $journey->class + +Returns an integer identifying the the mode of transport class. +Semantics depend on backend, e.g. "1" and "2" for long-distance trains and +"4" and "8" for region trains. + =item $journey->line Returns the line identifier, or undef if it is unknown. -- cgit v1.2.3