Unix Oracle / Perl driver problem - perl

I have a script that is using DBI to interface with Oracle, but I keep getting the following error:
install_driver(Oracle) failed: Can't
load
'/usr/opt/perl5/lib/site_perl/5.005/aix/auto/DBD/Oracle/Oracle.s
o' for module DBD::Oracle: dlopen:
/usr/opt/perl5/lib/site_perl/5.005/aix/auto/DBD/Oracle/Oracle.so:
can't load library
/usr/opt/perl5/lib/site_perl/5.005/aix/auto/DBD/Oracle/Oracle.so50
/usr/oracle/lib/libclnts h.a shr.o103
/usr/oracle/lib/libclntsh.a shr.ocan't
load library
/usr/oracle/lib/libclntsh.a50
/usr/oracle /lib/libclntsh.a at
/usr/local/lib/perl5/5.6.0/aix/DynaLoader.pm
line 200. at (eval 1) line 3
Compilation failed in require at (eval
1) line 3. Perhaps a required shared
library or dll isn't installed where
expected at ./dbi_test.pl line 9
Line 9 is were id do the prepare
statement in my perl script: my $sth =
$dbh->prepare('Sql statement here')
or die "Couldn't prepare statement: " . $dbh->errstr;
I looked and I have 2 versions of Perl installed in the /usr/opt/perl5/lib/site_perl/ directory:
5.005 and 5.8.0
My boss informed me that the version of AIX installs one version and our version of Oracle installs another. So I'm thinking I'm loading the wrong driver, but am not sure.
Does anyone see what might be the problem?
Any help is appreciated.

It looks like you might have installed the DBI driver under your 5.8 perl installation, but the system is using the 5.005 installation when your script is run (probably due to your PATH setting). Change your path to use the 5.8 executable, and set your PERL5LIB environment variable to include the 5.8 library paths.
If you have to use the 5.005 version, then install DBI under that version as well.

Related

I had installed perl module, parse::recdescent, still I m getting module not installed error

I m trying to create charts for excel from perl script.
I have perl 5.22 version.
I installed perl module parse-recdescent.
I can verify its presence in my Unix box with the command instmodsh.. And I can see this module installed.
I had successfully set the path for perl5lib.
But still when my script comes at chart->add_series() function, its failing with error below
The Parse::recdescent module must be installed in order to write an excel formula at line x
I had installed this module same as all other modules which works fine.
All paths looks correct...
Please help me.
Update:
Error message: "The Parse::RecDescent module must be installed in order to write an Excel formula at charts4.ps line xxx
Here you can see i installed perl modules and Parse::RecDescent is there. I used instmodsh command...
Installed modules are: Parse::RecDescent
i am using PERL5LIB to set the paths of all modules..
my PERL5LIB looks like below:
/home/xxx/perl/Parse-RecDescent-1.967013/blib/lib/Parse
and you can see .pm is there in this path
$ cd /home/xxx/perl/Parse-RecDescent-1.967013/lib/Parse
$ ls -ltr total 440 -rw-r--r-- 221678 Sep 27 12:28 RecDescent.pm
FYI - This unix box has already a perl installed.. but i had installed my own version. and when i type perl -v it is giving my own version.. perl 5 vesrion 22 as expected. and i had installed many modules in the same way and all are working fine. except this... Want to know whats going wrong?
i am using PERL5LIB to set the paths of all modules..
my PERL5LIB looks like below:
/home/xxx/perl/Parse-RecDescent-1.967013/blib/lib/Parse
and you can see .pm is there in this path
$ cd /home/xxx/perl/Parse-RecDescent-1.967013/lib/Parse $ ls -ltr
total 440 -rw-r--r-- 221678 Sep 27 12:28 RecDescent.pm
Some weirdness here. You say that you have installed Parse::RecDescent, but this doesn't look like an installed version. This looks like a directory that is used as part of the installation process, not the final result. How did you install the module?
But despite the fact that this isn't really where you should be using this module from, it should still work if you set PERL5LIB correctly. You have an extra Parse on the end of your directory. As the module is in Parse/RecDescent.pm the correct value for PERL5LIB will be /home/xxx/perl/Parse-RecDescent-1.967013/blib/lib/.
I really recommend that you install this module properly.

Perl Par::Packer Can't find module issue

I have a perl program that uses WWW::Mechanize::Firefox on windows 7 32bit with strawberry perl.
It works fine with the command C:\>perl testcase.pl. When I compile it with C:\>pp -o testcase.exe testcase.pl it compiles with no errors.
When I run the testcase.exe it gives me the error:
Failed to connect to , Can't locate object method "setup" via package "MozRepl::Client" at MozRepl.pm line 224
The code I am using for testcase.pl is:
#!perl
use MozRepl;
use WWW::Mechanize::Firefox;
use warnings;
system('start firefox');
sleep(5);
$mech = WWW::Mechanize::Firefox->new;
Also note that a program without WWW::Mechanize::Firefox and MozRepl does work fine.
The problem has obviously been narrowed down to PAR::Packer not liking MozRepl, any idea what it might be?
PAR::Packer sometimes has a hard time identifying which modules need to be included in a PAR package in order to fulfill all of the requirements of the program you are trying to package.
It copes OK if the dependancies are loaded via plain 'use', or 'require' statements where the module to be loaded is a literal string, but it won't have much chance if the module is being loaded dynamically with something like:
require $myModuleToLoad;
Browsing the source code of MozRepl and related modules shows that they make heavy use of plugins loaded dynamically. I suspect that some of these are not being packaged.
You can manually specify module(s) to be included in the PAR package by adding -M Module::Name to the pp command line for each of the modules to be added (replacing Module::Name with the actual module name of course).
The hard part might be identifying which modules to include. One way to do this is to temporarily add something like this to the end of your script:
END { print "$_ -> $INC{$_}\n" foreach sort keys %INC; }
then run your script normally, not through PAR. It should list all the modules that were loaded. You can compare that with the actual modules present in the PAR package and add the missing ones using the -M option to pp.
You can see the modules inside your PAR file by opening it with an unzipping tool, such as 7zip. Or in Linux:
unzip -l {parfile}

install CPAN module ClearCase::CtCmd

I need to install the CPAN module ClearCase::CtCmd. I have downloaded the module CtCmd-1.09. After running the command perl Makefile.PL I am having the following errors:
perl Makefile.PL
Looking for ClearCase version 7 Found 7.1
Looking for gcc version 2.7 Found 3.4
Looking for SunOS 5.7 Found 5.8
Checking if your kit is complete...
Use of uninitialized value in chdir at /usr/local/lib/perl5/5.8.5/File/Find.pm line 741.
Use of chdir('') or chdir(undef) as chdir() is deprecated at /usr/local/lib/perl5/5.8.5/File/Find.pm line 741.
Looks good
Could not open 'CtCmd.pm': No such file or directory at /usr/local/lib/perl5/5.8.5/ExtUtils/MM_Unix.pm line 3079.
I mention that the perl version is v5.8.5. In the INSTALL file it is stated that "The ClearCase::CtCmd module requires Perl v5.6.1 or v5.8 or later."
What type of machine is this on? Solaris? Doesn't ClearCase come with its own version of Perl that already includes ClearCase::CtCmd?
Use of uninitialized value in chdir at /usr/local/lib/perl5/5.8.5/File/Find.pm line 741.
Use of chdir('') or chdir(undef) as chdir() is deprecated at /usr/local/lib/perl5/5.8.5/File/Find.pm line 741.
Looks good
File::Find is a standard Perl module. The uninitialized value in chdir does not look good.
Could not open 'CtCmd.pm': No such file or directory at /usr/local/lib/perl5/5.8.5/ExtUtils/MM_Unix.pm line 3079.
ExecUtils/MakeMaker is calling ExtUtils/MM_Unix.pm and is trying to write your Makefile. I have a feeling it's suppose to locate where CtCmd.pm is located from File::Find and with File::Find failing, MakeMaker can't create the Makefile.
I'm looking at the Makefile.PL and see that it requires $ATRIA_ROOT to be set, or otherwise, it's inferred as being at /opt/rational/clearcase. Could this have something to do with it?
No. Doesn't look like it. Otherwise, you wouldn't have gotten the report on the ClearCase version. And, I guess the system is Solaris because that's the only place where the gcc version is being searched.
I think it's time to do a bit of munging in the Makefile.PL program to see what it's doing. I notice in line #218 is WriteMakefile(%opts); I would add a little routine to print out this %opts subroutine (probably using warn instead of print). This subroutine is from ExtUtils::MakeFile which actually writes the Makefile. It might give you a clue to what's going on.
Unfortunately, the problem looks like it has to do with the way ExtUtils::MakeMaker is working. Using Perl 5.8.5 means you have an older, buggier version of ExtUtils::MakeMaker. You can look at the release notes of ExtUtils::MakeMaker and see if that offers you any clue. Perl 5.8.5 is no longer supported. It's a very, very old version of Perl.

Cant Locate Image/Info.pm Module Error

I'm trying to get the resolution,width,height of the images in the specific file.
I have the following code.
#use strict;
use Image::Info qw(image_info dim);
use File::List;
#perl2exe_include Image::Info::JPEG;
#perl2exe_include PerlIO;
my $file = <ImageFilePath>;
my $info = image_info($file);
my $res = $info->{resolution};
print "$$res[0]\n";
I have the Perl Version 5.16.3
I get the following error:
Can't locate Image/Info.pm in #INC (#INC contains: c:\program files\Perl\lib c:/program files/Perl/site/lib c:/program files/Perl/lib .) at Img_Res.pl line 3.
BEGIN failed--compilation aborted at Img_Res.pl line 3.
Can anyone give me the solution to this?
From the code part of question I am concluding that you are trying to create an executable using Perl2EXE, because you are using the line
#perl2exe_include Image::Info::JPEG;
and also assuming that you are running command
perl2exe c:\somepath\somescript.pl -o somescript.exe
The answer from #James Green is correct to an extent, however its incomplete (as in fails to explain his second bullet point).
You need to install "Image::Info" and any other modules that you are using (Use the answer from #James Green).
After installation, Open to windows explorer and locate the module that you just installed,
It will normally be in the following folders
"PERL_PATH\perl\lib"
"PERL_PATH\perl\site\lib"
"PERL_PATH\perl\vendor\lib"
Once you locate the module is installed in the one of the 3 locations above. Navigate to the location where Perl2EXE is installed.
PERL2EXE_PATH\perl2exe-XX.xx-Win\
Locate the folder with the current version of perl you are using. In your case the folder name should be
Win32-5.16.3 or Win64-5.16.3
Open the folder and locate the .conf file.
Edit the line with header libdir.
libdir=perl-Win32/site/lib;perl-Win32/lib;perl-Win32/vendor/lib;.
Ensure all the perl/lib directories are included in the search path.
Save it and rerun your command. This should work.
Sometimes even after all this the perl2exe command fails, this is due to the limitation of the program being able to decipher the qw command.
So to avoid this directly call the module (ex: use Module::Name;) in your code instead of using the qw.
You need to ensure you've done two things:
install the Image::Info module
make sure #INC includes the path to wherever you installed the module
I see you're on Windows, which means you're likely using either Strawberry Perl, or ActiveState's Perl. If you're using Strawberry Perl you should have some success following the directions on http://www.cpan.org/modules/INSTALL.html -- I believe ActiveState has its own built-in package manager, ppm, and to get started with that you'll want to look here: http://www.activestate.com/activeperl/ppm-perl-modules

Fail to load the App due to ODBC driver

install_driver(ODBC) failed:
Can't load '/usr/local/lib/perl5/auto/DBD/ODBC/ODBC.so' for module
DBD::ODBC: libodbc.so.1: cannot open shared object file: No such file
or directory at /usr/lib/perl5/DynaLoader.pm line 200. at (eval 3)
line 3 Compilation failed in require at (eval 3) line 3. Perhaps a
required shared library or dll isn't installed where expected at
M_BLACKLIST.pl line 14
I have using latest unixodbc dbi drvier.
Basically i use centos 6.
Just be aware, that the latest unixODBC build will create libodbc.so.2, the number was incremented after the SQLLEN change to the api a year or so ago May not be the problem, but worth checking what libodbc.so you actually have.