David:

Assuming you are using IIS on a Windows box, tweak the application configuration for perl.  Mine defaults to D:\Perl\bin\perl.exe "%s" %s.
 
Normally I change it to something like D:\Perl\bin\perl.exe -I D:\myworkdir %s %s
 
There is also a registry setting that ActiveState perl uses to get this info.  Don't recall what it is off the top of my head, I think the ActiveState documents point to it.
 
E. Scott Stricker - NGIT @ Smartlink
----- Original Message -----
Sent: Tuesday, June 10, 2003 2:18 PM
Subject: Globally change working directory for perl cgi?

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

 

 

Reply via email to