On Tue, 17 Jun 2003, Oskar wrote: > ----- Original Message ----- > From: "Thomas Klausner" <[EMAIL PROTECTED]> > To: <[EMAIL PROTECTED]> > Sent: Tuesday, June 17, 2003 9:41 AM > Subject: Re: Current directory > > > Hi! > > > > On Tue, Jun 17, 2003 at 02:19:49AM +0200, Oskar wrote: > > > > > when I am executing perl script on Apache it seems that the > > > current directory is not the directory where the script is > > > located but the directory c:\program files\apache > > > group\apache. I need current dir to be the script dir since > > > i have some pm in the script directories. I have apache > > > 1.3.27 and mod_perl 1. > > > > See: > > http://perl.apache.org/docs/1.0/guide/porting.html#_INC_and_mod_perl > > > I already read that article before posted the message here but > it does not solve the problem: I am running more than one web > so the adding of each particular directory seems to me little > bit dumb. Also i dont see the reason why the current dir should > be changed to the dir different from the script dir. Any other > suggestion to solve it?
You might try the FindBin module; from the docs, NAME FindBin - Locate directory of original perl script SYNOPSIS use FindBin; use lib "$FindBin::Bin/../lib"; or use FindBin qw($Bin); use lib "$Bin/../lib"; However, note the following: KNOWN ISSUES If there are two modules using "FindBin" from different directories under the same interpreter, this won't work. Since "FindBin" uses "BEGIN" block, it'll be executed only once, and only the first caller will get it right. This is a problem under mod_perl and other persistent Perl environments, where you shouldn't use this module. Which also means that you should avoid using "FindBin" in modules that you plan to put on CPAN. The only way to make sure that "FindBin" will work is to force the "BEGIN" block to be executed again: delete $INC{'FindBin.pm'}; require FindBin; -- best regards, randy kobes