From f2b5d9bacf8e109fe27cea8f68232d41fd3b3ea5 Mon Sep 17 00:00:00 2001 From: Florian Pritz Date: Mon, 17 Dec 2018 16:33:25 +0100 Subject: Make context parameter explicit This prevents a loop in $deps->{..}->{context} which is 1) unnecessary and 2) potentially breaks memory recovery when things get deleted. Not the case right now, but whatever. Signed-off-by: Florian Pritz --- lib/App/ArchLinux/PackagerTools/CPAN.pm | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'lib/App/ArchLinux/PackagerTools/CPAN.pm') diff --git a/lib/App/ArchLinux/PackagerTools/CPAN.pm b/lib/App/ArchLinux/PackagerTools/CPAN.pm index de2a397..c48469a 100644 --- a/lib/App/ArchLinux/PackagerTools/CPAN.pm +++ b/lib/App/ArchLinux/PackagerTools/CPAN.pm @@ -37,20 +37,20 @@ Returns a new instance. =cut -method new($class: $deps = {}) { - $deps->{packages_details_fetcher} //= App::ArchLinux::PackagerTools::CPAN::PackagesDetailsFetcher->new({$deps->%{context}}); - return $class->new_no_defaults($deps); +method new($class: $context, $deps = {}) { + $deps->{packages_details_fetcher} //= App::ArchLinux::PackagerTools::CPAN::PackagesDetailsFetcher->new($context); + return $class->new_no_defaults($context, $deps); } -method new_no_defaults($class: $deps = {}) { - return $deps->{context}->{$class} if defined $deps->{context}->{$class}; +method new_no_defaults($class: $context, $deps = {}) { + return $context->{$class} if defined $context->{$class}; my $self = {}; bless $self, $class; $self->{deps} = $deps; $self->{dist_lc_map} = {}; $self->{dists} = {}; - $deps->{context}->{$class} = $self; + $context->{$class} = $self; $log->debug("Initialized new CPAN object"); return $self; } -- cgit v1.2.3-24-g4f1b