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

In reply to Need help on @INC by as00060

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.