"Coul not find a suitable Class::Load implementation" - perl-module

I am bulding an executable with PAR but It gives me the next error:
"Could not find a suitable Class::Load implementation : at Class/Load.pm line 51.
I would like to kwon why It makes that error.
Anyone could givbe me a solution please?

For some reason PAR can't find Class::Load::XS or Class::Load:PP.
You can try if those are at all on your include path with eg.: perl -MClass::Load::PP -e1
If not, try to (re?)install them or fix your classpath. The corresponding files in your filesystem should be Class/Load/XS.pm and Class/Load/PP.pm.
If the oneliner doesn't give you an error, it could be that PAR uses different include paths.
You can debug your include paths with eg. perl -le 'print for #INC' and temporarily add something to the path with the -I/my/path switch. Or you can use lib '/my/path'; in you perl files.

I solved it running pp with both -x and -c parameters
pp -x -c script.pl

Related

Can't load oracle.so

I am getting this exception:
Can't load '/usr/perl/lib/site_perl/5.8/x86_64-linux/auto/DBD/Oracle/Oracle.so' for module DBD::Oracle: libclntsh.so.8.0: cannot open shared object file:
No such file or directory at
/.../perl/lib/5.8/x86_64-linux/DynaLoader.pm line 169
If I do ls -ltr /.../perl/lib/site_perl/5.8/x86_64-linux/auto/DBD/Oracle/Oracle.so I see that the file is there. The process I am running also sets LD_LIBRARY_PATH before attempting to connect. A build and deploy on another machine doesn't produce the same error and runs fine. Running uname -sm gives Linux x86_64 on both machines. Is there something else that could cause this error?
Another solution:
Just pass your Oracle path variables before you run any scripts:
Like for perl you can do add below in beginning of your script:
BEGIN {
my $ORACLE_HOME = "/usr/lib/oracle/11.2/client64";
my $LD_LIBRARY_PATH = "$ORACLE_HOME/lib";
if ($ENV{ORACLE_HOME} ne $ORACLE_HOME
|| $ENV{LD_LIBRARY_PATH} ne $LD_LIBRARY_PATH
) {
$ENV{ORACLE_HOME} = "/usr/lib/oracle/11.2/client64";
$ENV{LD_LIBRARY_PATH} = "$ORACLE_HOME/lib";
exec { $^X } $^X, $0, #ARGV;
}
}
It looks like DBD::Oracle's Oracle.so is trying to open libclntsh.so.8.0 and can't find it. So you need to find out if that version of the shared library is installed.
Perform the following command:
$ locate libclntsh.so
You should get a list of files beginning with libclntsh.so. If you are lucky , libclntsh.so.8.0 will be among the results, and then you'll need to make sure that the directory that it lives in is on you load path. For instance my server has:
$ locate libclntsh.so
/home/oracle/11.2/lib/libclntsh.so
/home/oracle/11.2/lib/libclntsh.so.10.1
/home/oracle/11.2/lib/libclntsh.so.11.1
If locate fails completely, you can build the database using updatedb or you can try using find:
find / -name 'libclntsh.so*' -print
Use a pager or redirect stderr to a file because you might end up dealing with a lot of error messages from find, which is okay, but using less will allow you to just refresh the screen to see find's output.

Is there a way to compile Pascal program and put the generated files in a specific folder?

So I am trying to compile Pascal programs and everything is find; however, I would like to put the generated files after each compilation is a separated folder. I am looking of something like this: fpc "Destination Folder" "program.pas".
Thanks
From Alphabetical listing of command line options
-FE<x> Set exe/unit output path to <x>
-FU<x> Set unit output path to <x>, overrides -FE
So something like fpc program.pas -FEc:\output should work. I don't have fpc installed so I cannot verify. If you try it and get errors that you can't work through post them.
This one works for me:
fpc hello.pas -o"Web/hello.cgi"
I was using ubuntu, notice there is no space between the argument -o and the beginning of the path "Web/..."

Import an *.xls file in R?

I am struggeling to read an *.xls file into R:
I did the following:
I set my working directory to the *.xls file and then:
> library(gdata) # load the gdata package
> mydata = read.xls("comprice.xls", sheet=1, verbose=FALSE)
Mistake in findPerl(verbose = verbose) : perl executable not found. Use perl= argument to specify the correct path. mistake in file.exists(tfn) : unknown 'file' argument
However, my path is correct and there is the file! Whats wrong?
UPDATE
I have installed it already, however now I get: Exception: cannot find function "read.xls"...
This error message means that perl is not installed on your computer or it is not set on your path.
If the perl is installed then you can put argument perl= inside read.xls() function.
read.xls(xlsfile, perl="C:/perl/bin/perl.exe")
As an alternative, you could try xlsxpackage:
read.xlsx("comprice.xls", 1) reads your file and makes the data.frame column classes nearly useful, but is very slow for large data sets.
read.xlsx2("comprice.xls", 1) is faster, but you'll have to define column classes manually. If you run the command twice, you will not need to count columns so much:
data <- read.xlsx2("comprice.xls", 1)
data <- read.xlsx2("comprice.xls", 1, colClasses= rep("numeric", ncol(data)))
Perl is either not installed or cannot be found. You can either install it, or specify the path where it is installed using
perl='path of perl installation'
in the call.

How to use perl dbmopen on Windows and Linux

I have a perl script that runs fine on Linux but fails on Windows at this point:
$freq{total} = 0;
dbmopen(%freq,$dictfile,0666) || die "Error: Cannot open dbmfile $dictfile";
$dictfile points to the proper location on the respective platforms. Changing the 0666 file permissions does not help. The file to open is a text file encoded in gb18030.
Is there a trick? Do I need to declare the encoding to open it on Window? Or possibly a different perl distro on Windows. I'm using Strawberry Perl.
Thanks.
Edit: Sorry, if I'm stating the obvious, but I just re-read the question. When you say
The file to open is a text file encoded in gb18030.
Do you mean a plain text file?
If so I think thats your problem. dbmopen is for indexed database file, ideally created by dbmopen in a previous run of you perl program. For plain text files you cannot bind them to hashes.
My previous resonse...
It works for me on Windows with Strawberry perl 5.12.1 running on Windows7x64. Which windows perl are you using? Make sure your installation has at least one of the DBM modules with it.
Some other points which might help:
You should include $! in your die statement, it will give you the error message for the failed open. So hopefully answer your question.
dbmopen will clear the contents of the %freq hash, so you will lose $freq{total} (because its 0 you may not notice). Usual pattern is: dbmopen, change some hash values, dbmclose
Edits:
$! is the variable which contains the error test of any failed "system" call. So you open line should be something like:
dbmopen(%freq,$dictfile,0666) || die "Error: Cannot open dbmfile $dictfile: $!";
To check for the standard DBM modules you can run the following from the command prompt
for %m in ( DB_File GDBM_File SDBM_File NDBM_File ODBM_File ) do #perl -M%m -e "print qq(%m: $%m::VERSION\n)"
For me that gives:
DB_File: 1.82
GDBM_File: 1.10
SDBM_File: 1.06
Can't locate NDBM_File.pm in #INC (#INC contains: C:/Nerd/StrawberryPerl/perl/site/lib C:/Nerd/StrawberryPerl/perl/vendor/lib C:/Nerd/StrawberryPerl/perl/lib .)
.
BEGIN failed--compilation aborted.
Can't locate ODBM_File.pm in #INC (#INC contains: C:/Nerd/StrawberryPerl/perl/site/lib C:/Nerd/StrawberryPerl/perl/vendor/lib C:/Nerd/StrawberryPerl/perl/lib .)
.
BEGIN failed--compilation aborted.
Which effectively meands I have DB_File, GDBM_File, and SDBM_File. But not NDBM_File or ODBM_File. Sorry I don't know how to find out which module dbmopen uses by default.
Personally I always use a specific module and then use the tie operator instead of dbmopen.

Why MSYS can't recognize tar-ustar option in AM_INIT_AUTOMAKE?

When I'm trying to run autogen from MSys 1.11 on a source, it always giving an error called,
configure.ac:9: option 'tar-ustar' not recognized
Can anyone please help me to get-rid of this error ?
Note:
andtar-v7, tar-ustar, tar-pax. all these 3 didn't work. Thank you...
Just remove the tar-ustar option from your configure.ac file (look for an AM_INIT_AUTOMAKE line) or install a newer version of Automake (1.9+). It should fall back to v7-style tar (in spite of not recognizing tar-v7).
tar is the command - the '-' and the letters after it is a parameter. You want:
tar -ustar
notice the space. Having said that, I don't believe that -ustar is a valid combination of tar options, but you should get a different error message for that.

Resources