summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/App/ArchLinux/PackagerTools/CPAN.pm5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/App/ArchLinux/PackagerTools/CPAN.pm b/lib/App/ArchLinux/PackagerTools/CPAN.pm
index 4efc4df..1e1c86c 100644
--- a/lib/App/ArchLinux/PackagerTools/CPAN.pm
+++ b/lib/App/ArchLinux/PackagerTools/CPAN.pm
@@ -48,7 +48,6 @@ method new_no_defaults($class: $deps = {}) {
$self->{deps} = $deps;
$self->{dist_lc_map} = {};
$self->{dists} = {};
- $self->_build_dist_index();
return $self;
}
@@ -89,6 +88,7 @@ method search_dist($name) {
$name =~ s/::/-/g;
$log->tracef("Searching for CPAN distribution matching '%s'", $name);
+ $self->_build_dist_index();
my $index_name = $self->{dist_lc_map}->{lc($name)};
if (defined $index_name) {
return $self->{dists}->{$index_name};
@@ -114,6 +114,7 @@ method get_dist($dist_name) {
$dist_name =~ s/::/-/g;
$log->tracef("Getting CPAN data for distribution '%s'", $dist_name);
+ $self->_build_dist_index();
my $index_name = $self->{dist_lc_map}->{lc($dist_name)};
if (defined $index_name) {
return $self->{dists}->{$index_name};
@@ -133,6 +134,8 @@ Set up the internal index of CPAN distributions
=cut
method _build_dist_index() {
+ return if (scalar(keys $self->{dists}->%*) > 0);
+
$log->debug("Fetching CPAN modules index");
my $out = $self->{deps}->{packages_details_fetcher}->get_packages_data();;
my %seen;