diff options
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; } |