HEX
Server: Apache
System: Linux sh-pro142.hostgator.com.br 5.14.0-162.23.1.9991722448259.nf.el9.x86_64 #1 SMP PREEMPT_DYNAMIC Wed Jul 31 18:11:45 UTC 2024 x86_64
User: okform09 (1324)
PHP: 8.3.30
Disabled: NONE
Upload Files
File: //usr/share/doc/perl-Parallel-ForkManager/examples/parallel_get.pl
use strict;
use warnings;

if (not @ARGV) {
  die <<"DIE";
Usage: $0  URL URL...
 e.g.: $0 http://cpan.metacpan.org/authors/id/D/DL/DLUX/Parallel-ForkManager-0.7.9.tar.gz
DIE
}

use Parallel::ForkManager;
use LWP::Simple;

my $pm = Parallel::ForkManager->new(10);

for my $link (@ARGV) {
  $pm->start and next;

  my ($fn) = $link =~ /^.*\/(.*?)$/;

  if (!$fn) {
    warn "Cannot determine filename from $fn\n";
  } else {
    $0 .= " $fn";
    print "Getting $fn from $link\n";
    my $rc = getstore($link, $fn);
    print "$link downloaded. response code: $rc\n";
  };

  $pm->finish;
};