summaryrefslogtreecommitdiff
path: root/lib/Travel/Status
diff options
context:
space:
mode:
authorBirte Kristina Friesel <derf@finalrewind.org>2023-12-14 19:06:40 +0100
committerBirte Kristina Friesel <derf@finalrewind.org>2023-12-14 19:06:40 +0100
commit57a496a1deb1d82fb34a62b066c9ba47cf38bad1 (patch)
tree0246899d9c010c7af4b831e1fd3eadc18d94b88c /lib/Travel/Status
parent8af2aecb4a1e5d3ba711d5e1b6193bfbffb74773 (diff)
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.
Diffstat (limited to 'lib/Travel/Status')
-rw-r--r--lib/Travel/Status/DE/HAFAS/Journey.pm5
1 files changed, 1 insertions, 4 deletions
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;