Dear All, I'm trying out mod_perl and I've been running into problem. The perl script below works fine as a CGI from Apache. But when running it through mod_perl, I get:
[error] Can't locate object method "connect" via package "DBI" (perhaps you forgot to load "DBI"?) at /home/ab1/test5.pl line 5.\n >From my first line I obviously use DBI. It doesn't fail at that line, so it should be loaded. However, when using it, it seems I doesn't since it doesn't have the method connect. How can this be? It works fine from the commandline as well. Just not when running it through mod_perl. Could anyone explain a newbie why this is or where I can define the include-path it should search for DBI? Cheers Nik use DBI(); print "Content-type: text/plain\n\n"; my $dbh=DBI->connect("DBI:mysql:database=db;host=db8.domain.tld", "user", "pass", {'RaiseError'=>1}); my $sth=$dbh->prepare("SELECT * FROM Item WHERE Id = 1"); $sth->execute(); my $ref=$sth->fetchrow_hashref(); print "modPerl test5: $ref->{'Item'}";