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

This is a very well known common issue when using modules from CPAN.I have installed activeperl which comes with in-built dbi.pm module, my system didn't have any perl before activeperl. So, I assume that as soon as the code is executed the .pl file should refer to " /opt/perl/ActivePerl-5.20/site/lib, and /opt/perl/ActivePerl-5.20/lib" by default. But its not happening, instead I am getting below error,

------------------------------------------- "Can't locate dbi.pm in @INC (you may need to install the dbi module) +(@INC contains: /opt/perl/ActivePerl-5.20/site/lib /opt/perl/ActivePe +rl-5.20/lib .) at dbi.pl line 1. BEGIN failed--compilation aborted at dbi.pl line 1." --------------------------------------------
Following is the dir structure from my machine
========================== [root@localhost lib]# pwd /opt/perl/ActivePerl-5.20/lib [root@localhost lib]# [root@localhost lib]# ll | grep -i dbi drwxr-xr-x. 9 root root 4096 Jul 19 14:42 DBI -r--r--r--. 1 root root 315053 Jan 11 2015 DBI.pm -r--r--r--. 1 root root 1533 Apr 4 2013 dbixs_rev.pl -r--r--r--. 1 root root 4561 Jul 19 12:44 FindBin.pm ====================== </p>
Following is the code
use dbi; use diagnostics; use strict; my $dbh = DBI->connect("dbi:Oracle:host=192.168.0.10", $dbuser, $dbpas +s)|| die " + $!"; $db->{AutoCommit} = 0; $db->{RaiseError} = 1; $db->{ora_check_sql} = 0; $db->{RowCacheSize} = 16; my $SEL = "SELECT * FROM HR"; my $sth = $db->prepare($SEL); $sth->execute(); while ( my @row = $sth->fetchrow_array() ) { foreach (@row) { $_ = "\t" if !defined($_); print "$_\t"; } print "\n"; } END { $db->disconnect if defined($db); }
Please guide. Regards, Amit

Replies are listed 'Best First'.
Re: Need help on @INC
by Anonymous Monk on Sep 26, 2015 at 04:27 UTC
    DBI and dbi aren't the same, you typed dbi but you want DBI, perl is case sensitive, the name must be exact, its DBI
      Hi, I realised my mistake after I posted the comment. We can conclude the discussion. Thanks your time. Regards, Amit