O mighty Wizards please help if you can:
I'm trying to use the plain vanilla TicketTool.pm from O'Reilly's mod perl
book, Apache Modules with Perl and C. It uses Tie::DBI to create a hash of
the mysql connection. When I run just the authentication subroutine with
Perl -d "authenticate.pm" it runs fine. Whe I run it as part of the web
server, it fails in the connect statement in the Tie:DBI routine. I've
been struggling for months on this. Could anyone help? I figured maybe I
have a "use statement wrong but I've tried more combos than I'll ever
remember.
John Mulkerin
Use lines from TicketTool.pm:
package Apache::TicketTool; use strict; use Tie::DBI (); use
CGI::Cookie (); use MD5 (); use LWP::Simple (); use Apache::File
(); use Apache::URI (); use DBI;
Problem line in script:
tie my %DB, 'Tie::DBI', {
'db' => 'mysql:its',
'table' => 'passwd', 'key' => 'username',
'user' => 'helpman', password => 'secret01',
} or print "Couldn not open database \n";
Problem line in Tie::DBI
sub connect {
my ($class,$dsn,$user,$password,$options) = @_;
return DBI->connect($dsn,$user,$password,$options);
Startup.pl (from apache conf directory)
BEGIN {
use Apache ();
use lib Apache->server_root_relative('libexec/perl');
}
# Commonly used modules
use Tie::DBI ();
use Apache::DBI ();
use Apache::Registry ();
use Apache::Constants();
use CGI qw(-compile :all);
use CGI::Carp ();
1;
~