Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

can't locate DBI.pm

Status
Not open for further replies.

kate8

Programmer
Feb 14, 2001
184
US
Hi,
I just start programming with the DBI. But when I ran my cgi program under the command line, I got this message:

Can't locate DBI.pm in @INC (@INC contains: /usr/opt/perl5/lib/5.00503/aix /usr/
opt/perl5/lib/5.00503 /usr/opt/perl5/lib/site_perl/5.005/aix /usr/opt/perl5/lib/
site_perl/5.005 .) at ./speed.cgi line 17.

In the same program, I also use CGI:

#!/usr/bin/perl -w

use CGI;
use DBI; # Load the DBI module

but there is no problem with CGI module.
Why did I get this message? What should I do with it?
Can anyone help me out?
Thank you!!!!

 
What that means is that the DBI library has probably not been installed on your system, or if it has it's not in a directory in the @INC path. If you have access to do so, installing the DBI library shouldn't be difficult. If you don't have access, you might try asking your ISP to do it. Tracy Dryden
tracy@bydisn.com

Meddle not in the affairs of dragons,
For you are crunchy, and good with mustard.
 
Thank You!
How can I know if my system has DBI or not? How to check it?
 
On a linux system, you can use the following command to search for the DBI module:

for x in `perl -e 'print join"\n",@INC'`; do find $x -iname DBI.pm; done

and see if it returns something. For anyone suffering this problem on Windows NT platform, the command would be:

for /f %%x in (perl -e 'print join",",@INC') do dir %%x\DBI.pm

... at least, I think so. I don't have a system nearby to test this.

Hope this helps,

brendanc@icehouse.net
 
a simple but effective way to tell if a module is installed in the default location is to just try to 'use' it. From the commnad line, you can invoke perl with the '-e' switch and run a little code....

prompt>perl -e &quot;use BDI&quot; <return>

If that works, it will simply give you your prompt back. If it does not, it will give the complaint you descibed above meainng you probably don't have the module installed.

HTH


keep the rudder amid ship and beware the odd typo
 
I agree, but isn't it fun to use long complicated shell scripts?

Actually, there might be one use to the scripts above: verifying that the module isn't in some strange subdirectory... requiring that you call it with DBI::DBI.pm. Quite unlikely, but possible.

Anyway, goBoating's right; if you can't &quot;use&quot; the module, it probably isn't there at all.

brendanc@icehouse.net
 
Thank you, guys!!

I have tested my system with:

prompt>perl -e &quot;use BDI&quot; <return>

I got the same message as I described before. I also tested several modules, which are the modules I am using. They all work(simply give the prompt back). goBoating was right; my system doesn't have DBI module installed.
I am going to download and install DBI module. Any suggestion (my system is AIX)?
Thanks a lot!
 
' Never played on AIX...... my only suggestion would be to surf - lots of good stuff there.

That page is maintained by Alligator Descartes who literally wrote the book... .at least the one I have....'Programming the Perl DBI' from O'Reilly.

HTH


keep the rudder amid ship and beware the odd typo
 
You're most likely to find any module you need on Just do a search for &quot;DBI&quot;. Their documentation on installing on different systems is pretty good too.
Tracy Dryden
tracy@bydisn.com

Meddle not in the affairs of dragons,
For you are crunchy, and good with mustard.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top