The answer for the first question is, the scripts that use sos.pl do it
using a "require", so they can determine (at run-time) the directory from
which to require it, something like:
if ($a) {
        require "$a/sos.pl";
} else {
        require "$b/sos.pl";
}

sos.pl itself uses "use Module;", so it can't determine the directory at
run-time.

One of the responses that I got said to determine the directory of the
module inside a BEGIN block and have the "use lib ..." and "use Module"
after the BEGIN block. This worked fine.

Thanks for your answer.

Shlomo



-----Original Message-----
From: Michael Fowler [mailto:michael@;shoebox.net]
Sent: Thursday, October 17, 2002 11:59 PM
To: Reinstein, Shlomo
Cc: '[EMAIL PROTECTED]'
Subject: Re: How to use a module located relative to the current script


On Wed, Oct 16, 2002 at 05:05:09PM +0200, Reinstein, Shlomo wrote:
> Is there a way that I can say in "sos.pl" that I want to use the module
> located in "../modules" relative to it?

I've read through this thread and it sounds like you're trying to solve the
wrong problem, or perhaps going at it the wrong way.  At one point you
mentioned the scripts that use sos.pl know how to find it; how do they find
it?  Why can't you use that same algorithm they use to find the library
directory?

Also, it may be simpler to simply place sos.pl, and any additional modules
or libraries, in a Perl library directory, or in a directory mentioned in
the PERL5LIB environmental variable.

If that doesn't help, perhaps you could explain the relationship between
your scripts, sos.pl, and other modules a bit more.


Michael
--
Administrator                      www.shoebox.net
Programmer, System Administrator   www.gallanttech.com
--

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to