View Single Post
  #1 (permalink)  
Old 12-27-2008, 01:58 PM
mrtwister76 mrtwister76 is offline
Registered User
 
Join Date: Oct 2008
Posts: 1
mrtwister76 is on a distinguished road
cPAddon Script DBI problem

Hi All,

I'm trying to write my first cPAddon install script.
I need to use the DBI perl module in order to setup some details in the database after the installation.

If I SSH to the server as root, I can run perl scripts using the DBI module without problem, however, whist attempting to use DBI via cPanels 'Site Software' I get the following error:

Code:
Can't locate object method "connect" via package "DBI" (perhaps you forgot to load "DBI"?)
Anybody know how to load the DBI module when writing install scripts?
I'm using the following:

Code:
use DBI;
and in order to attempt to get the DBI module on the path:

Code:
BEGIN { unshift @INC, qw(/usr/lib/perl5/5.8.8/x86_64-linux/ 
/usr/lib/perl5/site_perl/5.8.8/x86_64-linux/Bundle/ 
/usr/lib/perl5/site_perl/5.8.8/x86_64-linux/Bundle/DBD 
/usr/lib/perl5/site_perl/5.8.8/x86_64-linux/auto/DBD/mysql); }
If I don't specify the above paths, perl uses these paths:

Code:
/usr/local/cpanel 
/usr/local/cpanel/cpaddons 
/usr/local/cpanel 
/usr/local/cpanel/perl 
/usr/local/cpanel/Cpanel/CPAN/overload/__Digest /usr/local/cpanel/build-tools/stubs 
/usr/lib/perl5/5.6.2/x86_64-linux 
/usr/lib/perl5/5.6.2 
/usr/lib/perl5/site_perl/5.6.2/x86_64-linux 
/usr/lib/perl5/site_perl/5.6.2 
/usr/lib/perl5/site_perl
For some reason, it's using the 5.6.2 path instead of the 5.8.8.

My script is located in /usr/local/cpanel/cpaddons/cPanel/Ecommerce

Any help appreciated ( this is driving me mad ).

Thanks,
Mark
Reply With Quote