Thanks. But how can I use the solution below in order to use a module? Keep in mind that when I type: use SomeModule; The "use" statement is executed at compile-time, not at run-time. Therefore, if I want to find the location of the current perl script, manipulate it and then use it to load the module, I need to do all this in BEGIN { } block so that it takes place at compile-time. I tried it and for some reason it didn't work, and since this happens at compile-time, I don't even know how to debug it to see what the problem is ("perl -d script" enters the debugger after the compilation, so the BEGIN {} block has already been executed, and in my case it simply told me there was an error and it didn't enter the debugger).
Shlomo -----Original Message----- From: Jenda Krynicky [mailto:[EMAIL PROTECTED]] Sent: Wednesday, October 16, 2002 8:07 PM To: Reinstein, Shlomo; [EMAIL PROTECTED] Subject: RE: How to use a module located relative to the current script From: "Reinstein, Shlomo" <[EMAIL PROTECTED]> > Thanks. However, I think this module won't help me. You see, > "some_path/lib/sos.pl" is not the "original" (bin) script, but rather > it's a library of routines used by many "original" scripts. That is to > say, users don't run "perl some_path/lib/sos.pl", but rather they run > some other script which knows how to locate and require sos.pl. Shlomo I see. Could you try to print $INC{'sos.pl'} or (if that doesn't print anything) use foreach (keys %INC) { print "\t$_ => $INC{$_}\n"; } This should tell you where was the sos.pl loaded from. You may then strip the 'sos.pl' from the path with a regexp and append '../modules'. Jenda -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]