http://www.perlmonks.org?node_id=130699

krishjack has asked for the wisdom of the Perl Monks concerning the following question:

Hai i am just new to perl. I installed activestate. I am trying to run one example from a book. The example uses DBI for getting the available drivers and connecting to a database. When i run the *.pl file from the browser, i am getting the error as:

Can't locate DBI.PM in @INC (@INC contains: C:/Perl/lib C:/Perl/site/lib .) at c:/apache/cgi-bin/sql_get.pl.

So after that i tried to install DBI.PM using PPM. It's then saying that it could'nt find the path for the PPD. can anyone guide me in this aspect.

I am using apache as my webserver to run my *.pl

Thx in advance.
jagan

Replies are listed 'Best First'.
Re: Can't locate DBI.pm in @INC
by Ovid (Cardinal) on Dec 10, 2001 at 21:46 UTC

    If you have just installed ActiveState, you don't have DBI as this is not a standard module. Use ppm. At the command line, type 'ppm'. When the prompt comes up, type 'install DBI' and follow the prompts.

Re: Can't locate DBI.pm in @INC
by Anonymous Monk on Apr 16, 2004 at 08:51 UTC
    If you don't have active perl (and hence don't have ppm), you can also get DBI like this:

    perl -MCPAN -e 'install DBI'

    That fixed it for me. And then you might need to install drivers like this (for Postgres):

    perl -MCPAN -e 'install DBD::Pg'

    Hope that helps.

Can't locate DBI.pm in @INC
by Avitar (Acolyte) on Nov 24, 2004 at 19:15 UTC
    Perl is installed, but the eggheads in their infinate wisdom forgot to add the path variable for the lib's you need for your os.

    I was able to work around this by adding "C:\Perl\lib;C:\Perl\site\lib" to the 'PATH' and/or 'PERL5LIB' environment variable.

    In windows 2000/2003/xp it cen be found near: right click my computer->properties->avanced tab Environmental Var

    David Smith
    Avitar.Net
Re: Can't locate DBI.pm in @INC
by Khen1950fx (Canon) on Jul 21, 2006 at 23:17 UTC
    Granted---this an old question, but I thought I would revisit it to see if I could help my friends. When I first started in Perl, I got the "Can't locate" warning a lot. In fact, most of the time. Then I discovered what it was that I was doing wrong. OK...I was a newbie...In my case, the answer was simple. I created a folder on my Desktop and named it, say Algorithm::Diff. Then I would put the tarball in it and extract it there. Then I would run perl Makefile.PL, then make---oops! "Can't locate" would pop up and up. Hmmm...I admit that it took me a long time to figure out this one---Perl accepts a double colon, but my system was looking for a single dash. The Algorithm::Diff folder on my Desktop was the problem. I renamed it to Algorithm-Diff, and then it worked. I learned my lesson---keep it simple. A simple mistake is usually the most deadly...

    If the path's ok, then the next thing I look at is dependencies. The output will usually tell you what module is missing. Sometimes the program will ask you if you want the module installed. Sometimes not. If not, then install it manually. Then I use pmvers from pmtools to make sure that the dependency is actually there. If it isn't, then pmvers will come back at you with it's own "Can't locate...". Check all the dependencies and the module that you're installing.

    Based on my own experience, the procedures above have solved my "Can't locate" problem 90% of the time. The remaining 10%---that's another question.

      there may be multiple perl binaries installed on your machine check your PATH which one are you accessing. I went thru this frustration once.
      Hi, On my case, my program works simetimes fine but simetimes i got the error "can't locate", all dependecies are installed. it's hard to find the source of this problem.
Re: Can't locate DBI.pm in @INC
by Anonymous Monk on Jun 18, 2004 at 03:16 UTC
    i have this problem..: CGI Error The specified CGI application misbehaved by not returning a complete set of HTTP headers. The headers it did return are: Can't locate http://www.etude.com.mx/cgi-bin/cgi-lib.pl in @INC (@INC contains: C:/Perl/lib C:/Perl/site/lib .) at \\172.21.6.14\s002\etude.com.mx\CGI-BIN\envia.pl line 6. mi mail is: tizac2001@etude.com.mx I dont find the answer of this error
Re: Can't locate DBI.pm in @INC
by Anonymous Monk on Feb 07, 2003 at 05:07 UTC
    I got the same error "can't locate DBI.PM in @INC". I rean ppm and install DBI commands. I got syntax error at line 1, column 0, byte 0 at C:/perl/site/lib/SOAP/Parser.pm line 73 error. Can any one help in this regard? Thanks, Sri.

    Originally posted as a Categorized Answer.

Re: Can't locate DBI.pm in @INC
by Anonymous Monk on Mar 06, 2010 at 22:01 UTC
    bash-2.05$ ./abc.pl Can't locate DBI.pm in @INC (@INC contains: /usr/perl5/5.6.1/lib/sun4-solaris-64int /usr/perl5/5.6.1/lib /usr/perl5/site_perl/5.6.1/sun4-solaris-64int /usr/perl5/site_perl/5.6.1 /usr/perl5/site_perl /usr/perl5/vendor_perl/5.6.1/sun4-solaris-64int /usr/perl5/vendor_perl/5.6.1 /usr/perl5/vendor_perl .) at ./abc.pl line 4. BEGIN failed--compilation aborted at ./abc.pl line 4.
Re: Can't locate DBI.pm in @INC
by krishjack (Initiate) on Dec 11, 2001 at 05:01 UTC
    Hai Ovid, Thanks for the information. It worked. Now i have another problem. I am trying to install modules that has database driver. I downloaded the *.tar.gz file. But when i try to install the file using PPM i am getting the following error. could'nt locate a PPD file for package DBD-ODBC-0.28.tar.gz. Can u help me out in this regard. Thx in advance jagan

    Originally posted as a Categorized Answer.

Re: Can't locate DBI.pm in @INC
by Anonymous Monk on Oct 23, 2003 at 00:37 UTC
    That crashes my computer and I have to reboot. I use Win 32.

    Originally posted as a Categorized Answer.