summaryrefslogtreecommitdiff
path: root/Porting
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2011-11-08 09:45:24 +0100
committerNicholas Clark <nick@ccl4.org>2011-11-18 11:08:57 +0100
commit6fdb59a5b63742625d027fa1c78f62ce9c9a681e (patch)
treee6ee1f3b90d39b28c78ff791e80071b084f70e76 /Porting
parentd7816c475cbc968366ca171e609094df68734963 (diff)
downloadperl-6fdb59a5b63742625d027fa1c78f62ce9c9a681e.tar.gz
In pod_lib.pl's get_pod_metadata(), generate lookup hashes directly.
Previously the code was structured to build arrays for various categories of files, then generate hashes from those arrays. However, the arrays had no other purpose, and the values in the hashes were only needed for truth tests, so it's better to generate the lookup hashes directly. @disk_pods hasn't actually been used since commit d5e2eea989a69524 refactored pod/buildtoc to no longer chdir to the pod/ directory.
Diffstat (limited to 'Porting')
-rw-r--r--Porting/pod_lib.pl17
1 files changed, 5 insertions, 12 deletions
diff --git a/Porting/pod_lib.pl b/Porting/pod_lib.pl
index 484c050931..00ab4b7349 100644
--- a/Porting/pod_lib.pl
+++ b/Porting/pod_lib.pl
@@ -107,10 +107,7 @@ sub get_pod_metadata {
# Sanity cross check
- my (%disk_pods, @disk_pods);
- my (@manipods, %manipods);
- my (@manireadmes, %manireadmes);
- my (@perlpods, %perlpods);
+ my (%disk_pods, %manipods, %manireadmes, %perlpods);
my (@cpanpods, %cpanpods, %cpanpods_short);
my (%our_pods);
@@ -128,7 +125,6 @@ sub get_pod_metadata {
opendir my $dh, 'pod';
while (defined ($_ = readdir $dh)) {
next unless /\.pod\z/;
- push @disk_pods, $_;
++$disk_pods{$_};
}
@@ -140,10 +136,10 @@ sub get_pod_metadata {
chomp;
s/\s+.*$//;
if (m!^pod/([^.]+\.pod)!i) {
- push @manipods, $1;
+ ++$manipods{$1};
} elsif (m!^README\.(\S+)!i) {
next if $state{ignore}{$1};
- push @manireadmes, "perl$1.pod";
+ ++$manireadmes{"perl$1.pod"};
} elsif (exists $our_pods{$_}) {
push @cpanpods, $_;
$disk_pods{$_}++
@@ -152,8 +148,6 @@ sub get_pod_metadata {
}
close $mani or my_die "close MANIFEST: $!\n";
- @manipods{@manipods} = @manipods;
- @manireadmes{@manireadmes} = @manireadmes;
@cpanpods{@cpanpods} = map { s/.*\///r } @cpanpods;
%cpanpods_short = reverse %cpanpods;
@@ -161,14 +155,13 @@ sub get_pod_metadata {
while (<$perlpod>) {
if (/^For ease of access, /../^\(If you're intending /) {
if (/^\s+(perl\S*)\s+\w/) {
- push @perlpods, "$1.pod";
+ ++$perlpods{"$1.pod"};
}
}
}
close $perlpod or my_die "close perlpod: $!\n";
my_die "could not find the pod listing of perl.pod\n"
- unless @perlpods;
- @perlpods{@perlpods} = @perlpods;
+ unless %perlpods;
my @inconsistent;
foreach my $i (sort keys %disk_pods) {