Hi!
I’m hoping this is a simple
one… The perl-cgi scripts on my webserver, located in the respective
websites cgi-bin directory require modules and/or other .pl
files.
These modules and .pl files are in
the same directory as the main perl cgi script. Therefore, it is assumed
that the statement:
require
“myfile.pl”;
OR
require
“./myfile.pl”;
would work without issue.
However, I always get the error
Can't locate myfile.pl in @INC (@INC contains:
C:/Perl/lib C:/Perl/site/lib .) at c:\mysite.com\www\cgi-bin\myprog.cgi line
2
I discovered, through the help of
someone else, this is due to the fact that the working directory is at
‘c:\mysite.com\www’ instead of at ‘c:\mysite.com\www’\cgi-bin’; the directory
is NOT set to the same as the directory the main cgi script is in but where
the html file resides that is calling it. I know that I can call the
chdir function from inside the perl script to get everything to reference
correctly but this is too messy to need to do for every cgi-perl script.
Is there some place where this can
be done globally? Some configuration file that is first interpreted by
each cgi-perl script so that I can change the working directory there; once
for all perl scripts?
Is there some configuration
setting to get this to function ‘properly’?
When these same scripts ran on a
Unix box, everything reference correctly. However, they do not on
Windows platform.
Thanks!
-Dave