Polyglot has asked for the wisdom of the Perl Monks concerning the following question:
Notably, no error appears for not finding the package, the error is for not finding its "connect" method. My code for that portion which connects to the database looks like this:[Sat Dec 31 19:14:39.401041 2022] [cgi:error] [pid 9360:tid 1864] [client 127.0.0.1:61019] AH01215: Can't locate object method "connect" + via package "DBI" at ../htdocs/mydir/my_mysql.pl line 621.: C:/xampp/cgi-bin/myscript.cg +i
I have tried a number of things including looking at the DB.pm package supplied with my copy of XAMPP (version 3.3.0). The DB.pm package is not in a directory named "DB", rather, it stands alone in the /lib/ subdirectory of XAMPP's perl installation. The word "connect" does not exist anywhere in the DB.pm file, and, as there appear to be no other files associated with the package--that's all, folks!use DB; our $database = 'script_db'; our $db_user_name = 'script_user'; our $db_password = 'my_secure_pw'; our $dsn = "DBI:mysql:$database:localhost"; # . . . {snip} #FOLLOWING LINE PRODUCES ERROR WITH XAMPP my $dbh = DBI->connect($dsn, $db_user_name, $db_password, { mysql_enable_utf8 => 1 }) or die "Can't connect to the DB: $DBI::errstr\n"; $dbh->{PrintError} = 1; $dbh->{RaiseError} = 1; $quest = $dbh->prepare($statement, { RaiseError => 1}) or die "Can +not prepare statement! $DBI::errstr\n"; $quest->execute();
Blessings,
~Polyglot~
|
---|