Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Specifying module path

Status
Not open for further replies.

umneydurak

Programmer
Jun 28, 2005
9
0
0
US
Hi.
I'm new to perl, so bear with me.
I'm trying to use DBI module to connect to MsSQL database from Unix server. Unfortenatly the admin on Unix server hid the module where the sun don't shine, and didn't add the path to the INV variable. I found the DBI.pm in /usr/local/(some more paths)/1.013/DBI.pm
I'm not sure how to point the script to it.
When I try: use "/usr/local/(some more paths)/1.013";, or
use /usr/local/(some more paths)/1.013; I get syntax error message.
I tried adding it to the inv variable with

use lib "/usr/local/(some more paths)/1.013";
no lib ".";
use DBI;
which didn't work either.

Anyway any help would be appreciated.

Thx.
 
There are several ways to do this, documented under @INC in perlvar
Code:
use lib '/usr/local/stuff/and/nonsense/';
seems the simplest, or you can start your script with
Code:
#!/usr/bin/perl -I /usr/local/stuff/and/nonsense/

Yours,

fish

"As soon as we started programming, we found to our surprise that it wasn't as easy to get programs right as we had thought. Debugging had to be discovered. I can remember the exact instant when I realized that a large part of my life from then on was going to be spent in finding mistakes in my own programs."
--Maurice Wilkes
 
Hi.
I tried it but when I do
Code:
use lib '/usr/local/some_dir';
no lib ".";
use DBI;
I get: Perl_sv_undef: referenced symbol not found at... on the use DBI; line.
Is it a bad installation of perl?

Thanks.
 
Unexpected!

You could try printing the contents of @INC
Code:
print join( ':', @INC ), "\n";
to see where it's looking, but I think there's something nasty going on. I'd certainly suspect the installation.

Yours,

f

"As soon as we started programming, we found to our surprise that it wasn't as easy to get programs right as we had thought. Debugging had to be discovered. I can remember the exact instant when I realized that a large part of my life from then on was going to be spent in finding mistakes in my own programs."
--Maurice Wilkes
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top