我試圖運行使用Parallel::ForkManager Perl腳本:錯誤使用並行:: ForkManager
#!/usr/bin/perl
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;
};
,但我得到了以下錯誤:
File::Path version 2.06 required--this is only version 1.08 at /usr/lib/perl5/5.8.8/File/Temp.pm line 14.
BEGIN failed--compilation aborted at /usr/lib/perl5/5.8.8/File/Temp.pm line 14.
Compilation failed in require at /usr/lib/perl5/site_perl/5.8.8/Parallel/ForkManager.pm line 441.
BEGIN failed--compilation aborted at /usr/lib/perl5/site_perl/5.8.8/Parallel/ForkManager.pm line 441.
Compilation failed in require at parallel.pl line 3.
BEGIN failed--compilation aborted at parallel.pl line 3.
我該如何解決這些問題?
更新您的Perl版本? – toolic
與您的問題無關:總是使用警告;嚴格使用;'。 'for'和'if/else'塊的括號後面不需要';':for(@foo){#do something}' – ThisSuitIsBlackNot
你是如何安裝Parallel :: ForkManager的?看來你做錯了。 – ysth