Return-Path: Delivered-To: apmail-perl-modperl-archive@www.apache.org Received: (qmail 69566 invoked from network); 7 Jul 2005 07:08:18 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 7 Jul 2005 07:08:18 -0000 Received: (qmail 69185 invoked by uid 500); 7 Jul 2005 07:08:05 -0000 Delivered-To: apmail-perl-modperl-archive@perl.apache.org Received: (qmail 69153 invoked by uid 500); 7 Jul 2005 07:08:04 -0000 Mailing-List: contact modperl-help@perl.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: List-Id: Delivered-To: mailing list modperl@perl.apache.org Received: (qmail 69140 invoked by uid 99); 7 Jul 2005 07:08:04 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 07 Jul 2005 00:08:04 -0700 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: domain of tomAtLinux@gmx.at designates 213.165.64.20 as permitted sender) Received: from [213.165.64.20] (HELO mail.gmx.net) (213.165.64.20) by apache.org (qpsmtpd/0.29) with SMTP; Thu, 07 Jul 2005 00:07:52 -0700 Received: (qmail invoked by alias); 07 Jul 2005 07:07:46 -0000 Received: from mail.bestsolution.at (EHLO [192.168.100.12]) [83.64.113.2] by mail.gmx.net (mp029) with SMTP; 07 Jul 2005 09:07:47 +0200 X-Authenticated: #6137719 Message-ID: <42CCD4C1.9030002@gmx.at> Date: Thu, 07 Jul 2005 09:07:45 +0200 From: Tom Schindl User-Agent: Mozilla Thunderbird 1.0.2 (X11/20050322) X-Accept-Language: de-DE, de, en-us, en MIME-Version: 1.0 To: Niklas Saers CC: modperl@perl.apache.org Subject: Re: DBI problem References: <491ac4fb050706062421553e00@mail.gmail.com> In-Reply-To: <491ac4fb050706062421553e00@mail.gmail.com> X-Enigmail-Version: 0.90.0.0 X-Enigmail-Supports: pgp-inline, pgp-mime Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Y-GMX-Trusted: 0 X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N -----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-----