Problem inserting data into a mysql database
I am having a problems inserting data into a mysql database.
I am in the process of migrating my website to Inmotion hosting. My site is an auction for the commercial fishing industry and has been up and running since 2011. It is written in Perl and operates out of the cgi-bin.
On the old server, modules appeared to have stored in the perl folder, whereas on the new server they are going into the perl5 folder. So I have added a number of “use lib” statements to include those folders.
This is what the current configuration looks like:
#!/usr/bin/perlml
BEGIN {
my $base_module_dir = (-d '/home/username/perl' ? '/home/username/perl' : ( getpwuid($>) )[7] . '/perl/');
unshift @INC, map { $base_module_dir . $_ } @INC;
}
use lib '/home/username/perl5/lib/perl5/x86_64-linux';
use lib '/home/username/perl5/lib/perl5/x86_64-linux/auto';
use lib '/home/username/perl5/lib/perl5/x86_64-linux-thread-multi/.meta';
use lib '/home/username/perl5/lib/perl5/x86_64-linux/Bundle';
use lib '/home/username/perl5/lib/perl5/x86_64-linux/BDB';
use lib '/home/username/perl5/lib/perl5/x86_64-linux/auto/DBI';
use lib '/home/username/perl5/lib/perl5/CGI/Session/Driver';
use lib '/home/username/perl5/man/man3';
use lib '/home/username/perl5/man/man1';
use lib '/home/username/perl5/bin';
use POSIX qw(strftime);
use File::Copy;
use strict;
use CGI;
use CGI::Session;
use CGI::Carp qw(fatalsToBrowser);
use File::CounterFile;
use Data::Dumper;
use DBI;
use DBD::mysql;
When I run a test sale with the buy-it-now feature, I get this error message as the sale is to be finalized and the data inserted into the mysql database:
Can't locate object method "connect" via package "DBI" (perhaps you forgot to load "DBI"?) at ../auction/buyit.pl line 286, line 85
The code at line 286 in buyit.pl is:
## connect to database
my $dbh = DBI->connect("DBI:mysql:$db:$server", $userid, $passwd);
When I go to the cPanel and look DBI is listed as installed.
And using the FTP program, CGI.pm is located in /perl5/lib/perl5/CGI"/Session/Driver.
Everything worked (works) perfectly fine on the old server. And on the new server I can call up the existing database and display past sales from the archive without a problem. I just can add to it.
Suggestions?