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 Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Relative path ..

Status
Not open for further replies.

rajeshacharya

Technical User
Feb 16, 2003
1
US
I am using a relative path in my perl program.for ex. use lib '../lib';. But when i run this perl file from any other folder say my home directory then obviously perl doesn't get lib folder. Is there any way(may be some env but still i don't want to give obsolute path) i can use the relative path and still can run it from any where. I don't wish to give obsolute path.

Thanks in advance
rajesh
 
your using perl modules right?
you can upload or copy the module file (use this as an example somemodule.pm) into the same folder as your script an use the use command like so:

use somemodule;

i had some what of that problem cause i use someone elses server so i have to aby by there rules
 
You can use an environmental variable but you will have to put the absolute path in the environmental variable. You can set the env variable 'MYPATH' and use it in the script as
Code:
use lib qw^$ENV{'MYPATH'}/lib^;
jaa
 
Oops! that should instead be:
[tt]
use lib qq^$ENV{'MYPATH'}/lib^;
[/tt]
The string has to be double quoted so the $ENV variable get interpolated.

jaa
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top