Use FindBin module.
The advantage is that FindBin module belongs to standard distribution
Your "some_path"/lib/sos.pl script will look like:
#!/usr/bin/perl -w
use strict;
use FindBin qw($Bin) # so $Bin contains your "some_path"/lib
#from here TMTWOTDI, one way is to pick up "some_path" from $Bin
my ($some_path)=$Bin=~/(\S+)\/lib/;
#then use lib
use lib ("$some_path/modules");
HTH,
Jos�.
> -----Original Message-----
> From: Reinstein, Shlomo [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, October 16, 2002 5:05 PM
> To: '[EMAIL PROTECTED]'
> Subject: How to use a module located relative to the current script
>
>
> Hi,
> From some perl script, say "some_path/lib/sos.pl", I would
> like to make use of a perl module, which is located at
> "some_path/modules". I don't know what "some_path" is inside
> "sos.pl", but I know that I can reach the module using a
> relative path "../modules". The problem is, writing "use lib
> '../modules'" treats the path as a relative path to the
> current directory, and not to the directory of "sos.pl" (if I
> understood correctly). Is there a way that I can say in
> "sos.pl" that I want to use the module located in
> "../modules" relative to it? Thanks, Shlomo
>
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
**** DISCLAIMER ****
"This e-mail and any attachment thereto may contain information which is confidential
and/or protected by intellectual property rights and are intended for the sole use of
the recipient(s) named above.
Any use of the information contained herein (including, but not limited to, total or
partial reproduction, communication or distribution in any form) by other persons than
the designated recipient(s) is prohibited.
If you have received this e-mail in error, please notify the sender either by
telephone or by e-mail and delete the material from any computer".
Thank you for your cooperation.
For further information about Proximus mobile phone services please see our website at
http://www.proximus.be or refer to any Proximus agent.
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]