diff options
author | Birte Kristina Friesel <derf@finalrewind.org> | 2023-11-25 10:02:01 +0100 |
---|---|---|
committer | Birte Kristina Friesel <derf@finalrewind.org> | 2023-11-25 10:05:30 +0100 |
commit | 9d928f5cf6bb4ec857bf2b300894d5fee5ec61e2 (patch) | |
tree | ba370f49dcfcaebeac9012a636397a487320e739 /lib/Travel/Status/DE/HAFAS/Journey.pm | |
parent | 6c2ebcb388c3ee99522b2afd9e83dcabe8eb4b61 (diff) |
Add support for stop-specific messages in journeys
Diffstat (limited to 'lib/Travel/Status/DE/HAFAS/Journey.pm')
-rw-r--r-- | lib/Travel/Status/DE/HAFAS/Journey.pm | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/lib/Travel/Status/DE/HAFAS/Journey.pm b/lib/Travel/Status/DE/HAFAS/Journey.pm index d8d63ff..eb00272 100644 --- a/lib/Travel/Status/DE/HAFAS/Journey.pm +++ b/lib/Travel/Status/DE/HAFAS/Journey.pm @@ -8,7 +8,8 @@ use 5.014; use parent 'Class::Accessor'; use DateTime::Format::Strptime; -use List::Util qw(any); +use List::Util qw(any); +use Scalar::Util qw(weaken); use Travel::Status::DE::HAFAS::Stop; our $VERSION = '5.00'; @@ -110,17 +111,18 @@ sub new { for my $stop ( @{ $journey->{stopL} // [] } ) { my $loc = $locL->[ $stop->{locX} ]; - push( - @stops, - { - loc => $loc, - stop => $stop, - common => $opt{common}, - date => $date, - datetime_ref => $datetime_ref, - strp_obj => $hafas->{strptime_obj}, - } - ); + my $stopref = { + loc => $loc, + stop => $stop, + common => $opt{common}, + hafas => $hafas, + date => $date, + datetime_ref => $datetime_ref, + }; + + weaken( $stopref->{hafas} ); + + push( @stops, $stopref ); $route_end = $loc->name; } |