where @INC variable is located
hi all.......
when i try to execute a perl script like use mysql; $host='localhost'; $database = "new"; $user = "root"; $pw = ""; $connect = mysql->connect($host, $database, $user, $pw); my $sth = $connect->prepare("desc hello"); $sth->execute; i am getting error Can't locate mysql.pm in @INC (@INC contains: /usr/lib/perl5/5.10......... but mysql.pm is located in /usr/lib/perl5/vendor_perl/5.10.0/i386-linux-thread-multi/Bundle/DBD/mysql.pm but i dont know where @INC variable is there to add this path can anyone please help me...... Thanks in advance....... |
I'm having the same problem. I hope someone could answer us here.
|
Hello Vinaytp,
@INC is an array which perl uses to find modules. You could try adding the following to your script. Code:
use lib '/usr/lib/perl5/vendor_perl/5.10.0/i386-linux-thread-multi/Bundle/DBD/'; |
First, print what your @INC contains exactly:
perl -e "print @INC;" and before you actually change it, make sure that you use Perl's DBD::mysql the right way which would be via DBI - as described in the perldoc page of DBD::mysql (perldoc DBD::mysql) http://search.cpan.org/~capttofu/DBD...b/DBD/mysql.pm You'll have to have DBI AND DBD::mysql installed. DBI is a so called "core module" which means As Perl's DBI interface is more or less always used the same way (despite the SQL dialects spoken to the database), please check one of the many, many available tutorials, you'll easily find with Google. There's also a nice book by O'Reilly's. |
hi all....
Thanks for the replies... I found the answer... here i have to set the environmental variable PERL5LIB='/usr/lib/perl5/vendor_perl/5.10.0/i386-linux-thread-multi' where DBI.pm package is located, then it worked better define this path in /etc/bashrc and execute source /etc/bashrc so that this path is available to all users.... |
If your Perl is installed correctly and you just use CPAN or install a module via "perl Makefile.PL" you don't have to touch @INC, because Perl knows its own module path.
Please install the modules correctly first before you touch @INC or change PERL5PATH. |
All times are GMT -5. The time now is 02:29 AM. |