6 use LWP::Simple qw /$ua getstore/;
18 foreach my $file (<*/*.pod */*/*.pod */*/*/*.pod README README.* INSTALL>) {
19 open my $fh => $file or die "Failed to open $file: $!\n";
21 if (m{(?:http|ftp)://(?:(?!\w<)[-\w~?@=.])+} && !exists $dummy{$&}) {
25 $urls {$url} {$file} = 1;
31 sub fisher_yates_shuffle {
32 my $deck = shift; # $deck is a reference to an array
35 my $j = int rand ($i+1);
36 @$deck[$i,$j] = @$deck[$j,$i];
40 my @urls = keys %urls;
42 fisher_yates_shuffle(\@urls);
45 warn "(", scalar @urls, " URLs)\n";
50 my $MAXFORK = $MAXPROC < $MAXURL ? 1 : $MAXPROC / $MAXURL;
52 select(STDERR); $| = 1;
53 select(STDOUT); $| = 1;
62 for ($i = 0; $i < $MAXFORK; $i++) {
63 $list[$i] = [ splice @urls, 0, $MAXURL ];
65 die "Failed to fork: $!\n" unless defined $pid;
66 last unless $pid; # Child.
72 1 until -1 == wait; # Reap.
75 foreach my $url (@{$list[$i]}) {
76 my $code = getstore $url, "/dev/null";
78 my $f = join ", " => keys %{$urls {$url}};
79 printf "%03d %s: %s\n" => $code, $url, $f;