perl-modperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tom Schindl <tomAtLi...@gmx.at>
Subject Re: DBI problem
Date Thu, 07 Jul 2005 07:07:45 GMT
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi,

Too few input to help you:
a) Show us your config? Are you running it as an Registry-Script?
b) What version of mod_perl are you using?
c) Modify include path with:
   1. In httpd.conf(see
http://perl.apache.org/docs/2.0/user/config/config.html):
      - PerlRequire startup.pl
      - PerlSwitches -I/my/include/modperl (mp2)
   2. In your module/script (use lib qw(/my/include/modperl))

Tom

Niklas Saers schrieb:
> 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'}";
> 
> 

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.0 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFCzNTBkVPeOFLgZFIRAt48AKCk5DQufpBGkL8kfsWBv2kTcXrRcACfW3oC
7c0mDHXzxk99lg9bSzPXZHI=
=fUnV
-----END PGP SIGNATURE-----

Mime
View raw message