From 57a496a1deb1d82fb34a62b066c9ba47cf38bad1 Mon Sep 17 00:00:00 2001 From: Birte Kristina Friesel Date: Thu, 14 Dec 2023 19:06:40 +0100 Subject: Journey: Do not weaken hafas reference in stop items The Stop constructor is called lazily and must have access to a hafas reference for its add_message function and strptime_obj key. If the hafas object goes out of scope before Journey->route is called, those may have been garbage-collected already. Apart from that, the weaken call was useless, since a Stop object does not store the hafas reference provided in its constructor. So, as soon as Journey->route is called, the hafas references in @{$journey->{route}} go out of scope anyways. --- lib/Travel/Status/DE/HAFAS/Journey.pm | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'lib/Travel/Status/DE') diff --git a/lib/Travel/Status/DE/HAFAS/Journey.pm b/lib/Travel/Status/DE/HAFAS/Journey.pm index 5bc7f80..9e12211 100644 --- a/lib/Travel/Status/DE/HAFAS/Journey.pm +++ b/lib/Travel/Status/DE/HAFAS/Journey.pm @@ -8,8 +8,7 @@ use 5.014; use parent 'Class::Accessor'; use DateTime::Format::Strptime; -use List::Util qw(any); -use Scalar::Util qw(weaken); +use List::Util qw(any); use Travel::Status::DE::HAFAS::Stop; our $VERSION = '5.01'; @@ -120,8 +119,6 @@ sub new { datetime_ref => $datetime_ref, }; - weaken( $stopref->{hafas} ); - push( @stops, $stopref ); $route_end = $loc->name; -- cgit v1.2.3