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,
Following is the dir structure from my machine------------------------------------------- "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 code========================== [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>
Please guide. Regards, Amituse 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); }
In reply to Need help on @INC by as00060
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |