ISAPI Perl Workaround for Unix Conventions Page 6
Download the authoritative guide: Data Center Guide: Optimizing Your Data Center Strategy
Download the authoritative guide: Cloud Computing: Using the Cloud for Competitive AdvantageSince ISAPI Perl honors neither of these conventions, workarounds must be provided. The workaround for the first line of the Perl script convention is that ISAPI Perl is associated with a file extension when ActiveState Perl was first installed. Thus, to run a CGI script under ISAPI Perl, the script should match the ISAPI Perl file extension specified when the ActiveState Perl installation program was run.
IIS and ISAPI Perl also have a problem recognizing the current working directory of a script. There are two ways around this problem: Give a hint to the Web server to let it know the current working directory of the script, or tell the script itself what the absolute path is to all the programs.
The easiest way to solve the problem is to provide a simple "hint" to the Web server about the current working directory in which the script should run. It turns out that IIS is not entirely clueless with regard to the path: It just needs a push in the right direction.
Setting up a Virtual Root on the IIS Server provides this "push." In the IIS management console, Virtual Roots essentially map a URL directory name to a physical directory on your machine. One of the default virtual roots is /cgi-bin -- which may point to a directory such as:
The tricky thing is that any scripts under that /cgi-bin virtual root are forced by IIS to use c:\inetpub\wwwroot\cgi-bin as the current working directory regardless of whether the script itself lies in a subdirectory.
To get around this problem, create a virtual root that points to the actual directory that the script lies in. For example, to create a virtual root to a calendar script, you might consider calling the virtual root /calendar-bin, and have it point directly to
If you have many scripts, however, adding virtual roots all the time can be a pain. To make it less odious, you might consider either modifying all the paths in the script to use absolute directory references or add a chdir() command to the top of the script.
The chdir() command is usually an easier solution, as it allows the script to maintain references to all data files and libraries using relative path references. The chdir command for the example above would be:
Remember, if you choose to use the MS-DOS convention of separating path names using the backslash, then you must escape the backslash when using Perl. The above chdir command using backslashes would look like the following:
IT Solutions Builder TOP IT RESOURCES TO MOVE YOUR BUSINESS FORWARD
Which topic are you interested in?
What is your company size?
What is your job title?
What is your job function?
Searching our resource database to find your matches...