I'm trying to run a Perl script that uses Parallel::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;
};
But I get the following errors:
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.
How can I resolve them?
Upgrade your version of File::Path.
As the error says, you're running version 1.08, but the version of ForkManager that you're running is dependent upon version 2.06.
Note also, that it appears that it is actually File::Temp, which has the File::Path dependency, while P::FM has a dependency on File::Temp.
Either way, you need a more recent version of File::Path.
Perl 5.8.8 is from 2006. Upgrade to a supported version
Related
I am trying to use wikiprep (https://github.com/avian2/wikiprep) to parse wikipedia dump (in Feb 2014) and generate a XXX.hgw.xml file from the dump.
I followed the usage on Github site above: installed all Perl modules as prerequisites; Build and install wikiprep successfully (wikiprep program appeared in perl5/bin directory). When I execute wikiprep, it says:
Use of the encoding pragma is deprecated at /home/tutran/perl5/bin/wikiprep line 32.
Use of the encoding pragma is deprecated at /home/tutran/perl5/lib/perl5/Wikiprep/languages.pm line 7.
syntax error at /home/tutran/perl5/lib/perl5/Wikiprep/Disambig.pm line 9, near "->import qw/ extractWikiLinks /"
Compilation failed in require at /home/tutran/perl5/bin/wikiprep line 52.
BEGIN failed--compilation aborted at /home/tutran/perl5/bin/wikiprep line 52.
This the line 9:
Wikiprep::Link->import qw/ extractWikiLinks /;
Expected output: options I can use with wikiprep. I also cannot make test for the program. I installed it on Ubuntu 14.04 LTS. My Perl version is 5.18.02.
I don't know anything about perl language so I can't do anything with the "syntax error" here!
You may need enable ut8 in your script. PLace this two lines before you start using this module:
use utf8;
use open qw( :encoding(cp866) :std );
In /usr/local/bin/ wikiprep change line 135 i'e (Wikiprep::Templates->import qw( %templates includeTemplates );) to :
Wikiprep::Templates->import(qw( %templates includeTemplates ));
and
in file
/usr/local/share/perl/5.18.2/Wikiprep/Disambig.pm
change
Wikiprep::Link->import qw/ extractWikiLinks /; to
Wikiprep::Link->import(qw/ extractWikiLinks /);
My computer crashed during a perl module installation using cpanm (I guess while installing Carp as a dependency of Moose). Now, when I try to use the modules I want to use, I get the following error:
user#linux:~$ ./script_using_moose.pl
Carp.pm did not return a true value at /usr/share/perl/5.14/diagnostics.pm line 185.
BEGIN failed--compilation aborted at /usr/share/perl/5.14/diagnostics.pm line 185.
Compilation failed in require at ./script_using_moose.pl line 5.
BEGIN failed--compilation aborted at ./script_using_moose.pl line 5.
user#linux:~$
And if I try to (re)install the package (using cpanm --reinstall or cpanm force) I get this other (similar) error:
user#linux:~$ sudo cpanm --force Moose
Carp.pm did not return a true value at /usr/local/share/perl/5.14.2/Parse/CPAN/Meta.pm line 6.
BEGIN failed--compilation aborted at /usr/local/share/perl/5.14.2/Parse/CPAN/Meta.pm line 6.
Compilation failed in require at /loader/0x1692090/App/cpanminus/script.pm line 11.
BEGIN failed--compilation aborted at /loader/0x1692090/App/cpanminus/script.pm line 11.
Compilation failed in require at /usr/bin/cpanm line 2029.
BEGIN failed--compilation aborted at /usr/bin/cpanm line 2029.
user#linux:~$
How can I resume installation or reconfigure/reinstall the incomplete module?
For some reason, a couple of files were created but not written to, or truncated. These can be easily identified in the full installation log as those modules with an undef version number:
Checking dependencies from MYMETA.json ...
...
Checking if you have Task::Weaken 0 ... Yes (undef)
...
Checking if you have Devel::GlobalDestruction 0 ... Yes (undef)
Reinstalling the modules Task::Weaken, and Devel::GlobalDestruction should do the trick.
I am making a very, very simple module (it is the first I've ever wrote):
package Master::Math;
use 5.12.4;
use strict;
use warnings;
require Exporter;
our #ISA = qw(Exporter)
our %EXPORT_TAGS = (
'all' => [ qw(
max
=cut
1; # End of Master::Math
When I run use this in my program, I get the error
Invalid version format (non-numeric data) at C:/Perl/lib/Master/Math.pm line 3,
near "package Master::Math
"
syntax error at C:/Perl/lib/Master/Math.pm line 3, near "package Master::Math
require Exporter"
Compilation failed in require at C:\MainDev\myperl\max.pl line 3.
BEGIN failed--compilation aborted at C:\MainDev\myperl\max.pl line 3.
What do I need to fix this? Thanks!
You're missing a semicolon on the declaration of #ISA.
In sub max, $foo is undeclared; use foreach my $foo ....
That should get it to compile. I haven't looked beyond that.
(BTW, I didn't get the same errors you did. I used perl 5.14.0, perl -cw master-math.pm.)
When I run the following to create an executable out of my Perl script:
pp -o process_target_mode_data Process_Target_Mode_Data.pl
I get the following error output:
Perl lib version (5.12.2) doesn't match executable version (v5.12.0) at /home/Neil/ActivePerl-5.12/lib/Config.pm line 50.
Compilation failed in require at /home/Neil/ActivePerl-5.12/lib/Errno.pm line 8.
BEGIN failed--compilation aborted at /home/Neil/ActivePerl-5.12/lib/Errno.pm line 8.
Compilation failed in require at /home/Neil/ActivePerl-5.12/lib/File/Temp.pm line 148.
BEGIN failed--compilation aborted at /home/Neil/ActivePerl-5.12/lib/File/Temp.pm line 148.
Compilation failed in require at /home/Neil/ActivePerl-5.12/lib/Archive/Zip.pm line 14.
BEGIN failed--compilation aborted at /home/Neil/ActivePerl-5.12/lib/Archive/Zip.pm line 14.
Compilation failed in require at -e line 459.
/home/Neil/ActivePerl-5.12/site/bin/pp: Failed to extract a parl from 'PAR::StrippedPARL::Static' to file 'parleNrP2Xi' at /home/Neil/ActivePerl-5.12/site/lib/PAR/Packer.pm line 1172, <DATA> line 1.
Could someone explain to me what is going on and how I can resolve this problem?
Info brian d foy requested:
[bash-3.2][Neil#willy]$ which pp
/home/Neil/ActivePerl-5.12/site/bin/pp
[bash-3.2][Neil#willy]$ /home/Neil/ActivePerl-5.12/site/bin/pp -o process_target_mode_data Process_Target_Mode_Data.pl
Perl lib version (5.12.2) doesn't match executable version (v5.12.0) at /home/Neil/ActivePerl-5.12/lib/Config.pm line 50.
Compilation failed in require at /home/Neil/ActivePerl-5.12/lib/Errno.pm line 8.
BEGIN failed--compilation aborted at /home/Neil/ActivePerl-5.12/lib/Errno.pm line 8.
Compilation failed in require at /home/Neil/ActivePerl-5.12/lib/File/Temp.pm line 148.
BEGIN failed--compilation aborted at /home/Neil/ActivePerl-5.12/lib/File/Temp.pm line 148.
Compilation failed in require at /home/Neil/ActivePerl-5.12/lib/Archive/Zip.pm line 14.
BEGIN failed--compilation aborted at /home/Neil/ActivePerl-5.12/lib/Archive/Zip.pm line 14.
Compilation failed in require at -e line 459.
/home/Neil/ActivePerl-5.12/site/bin/pp: Failed to extract a parl from 'PAR::StrippedPARL::Static' to file 'parludZfldz' at /home/Neil/ActivePerl-5.12/site/lib/PAR/Packer.pm line 1172, line 1.
[bash-3.2][Neil#willy]$
[bash-3.2][Neil#willy]$ /home/Neil/ActivePerl-5.12/bin/cpan -l | grep PAR
PAR 1.002
PAR::Dist 0.47
PAR::Heavy 0.12
PAR::Filter 0.03
PAR::SetupTemp 1.002
PAR::SetupProgname 1.002
PAR::Packer 1.006
PAR::StrippedPARL::Dynamic 0.958
PAR::StrippedPARL::Static 0.958
PAR::StrippedPARL::Base 0.975
PAR::Filter::Bytecode undef
PAR::Filter::Bleach undef
PAR::Filter::Obfuscate undef
PAR::Filter::PatchContent undef
PAR::Filter::PodStrip undef
App::Packer::PAR 0.91
Perl lib version (5.12.2) doesn't match executable version (v5.12.0)
Some parts of your Perl installation are at a different version than others. More specifically, if you look at /home/Neil/ActivePerl-5.12/lib/Config.pm line 50, you will see that there is an explicit comparison of the version of Perl being executed (which is 5.12.0) to the version of the Config.pm library being used (5.12.2).
If you perform a new installation of ActivePerl 5.12.2 (to bring all components up to the same version), this error should go away.
I had same issue. I installed PAR::Packer from Activestate Perl Package Manager (PPM). As mentioned above in one of the replies, there is version mismatch between the perl and pp binaries. Here's how I fixed it:
Uninstall PAR-Packer from PPM.
Open DOS command line.
Run cpan install PAR::Packer
This will download, compile, and install the package from CPAN. MinGW compiler toolchain will be downloaded as well, if needed. The whole process may take a while on slower cpus.
Find the location of that pp, then figure out its version. I bet it's left over from an earlier installation. Ensure that you have PAR for your new version of Perl.
You can also try specifying the location of the particular pp you want to use so you know exactly what one you are using:
$ /full/path/to/5.12.2/pp ...
Go to the perl/lib/Config.pm and changed the condition in the lines:
die "$0: Perl lib version (5.32.0) doesn't match executable '$^X' version ($])" unless $^V;
to
die "$1: Perl lib version (5.32.1) doesn't match executable '$^X' version ($])" unless $^V;
and the next line
$^V eq 5.32.0 or die sprintf "%s: Perl lib version (5.32.0) doesn't match executable '$^X' version (%vd)", $0, $^V;
to
$^V eq 5.32.1 or die sprintf "%s: Perl lib version (5.32.1) doesn't match executable '$^X' version (%vd)", $0, $^V;
this worked for me, at least it won't complain... yes, i know, PERL and Python are f***d up.
I have a Perl module that appears to compile fine by itself, but is causing other programs to fail compilation when it is included:
me#host:~/code $ perl -c -Imodules modules/Rebat/Store.pm
modules/Rebat/Store.pm syntax OK
me#host:~/code $ perl -c -Imodules bin/rebat-report-status
Attempt to reload Rebat/Store.pm aborted
Compilation failed in require at bin/rebat-report-status line 4.
BEGIN failed--compilation aborted at bin/rebat-report-status line 4.
The first few lines of rebat-report-status are
...
3 use Rebat;
4 use Rebat::Store;
5 use strict;
...
Edit (for posterity): Another reason for this to occur, and perhaps the most common reason, is that there is a circular dependency among the modules you are using.
Look in Rebat/Store.pm for clues. Your log says attempt to reload was aborted. Maybe Rebat already imports Rebat::Store, and Rebat::Store has some package-scope check against being loaded twice.
This code demonstrates the kind of situation I mean:
# m1.pl:
use M1;
use M1::M2;
M1::M2::x();
# M1.pm
package M1;
use M1::M2;
1;
# M1/M2.pm
package M1::M2;
our $imported = 0;
sub import {
die "Attempt to reload M1::M2 aborted.\n" if $imported++;
}
sub x { print "42\n" }
1;
$ perl m1.pl
Attempt to reload M1::M2 aborted.
BEGIN failed--compilation aborted at m1.pl line 3.
The code will compile (and print 42) if you just remove the use M1::M2 line in m1.pl. In your case, you might not need to explicitly use Rebat::Store in your program.
perldoc perldiag:
Attempt to reload %s aborted.
(F) You tried to load a file with "use" or "require" that failed to
compile once already. Perl will not try to compile this file again
unless you delete its entry from %INC. See "require" in perlfunc
and "%INC" in perlvar.