- 1 Red Hat Enterprise Linux 7.2 Enters Beta with Improved Container Support
- 2 VMware CEO Pat Gelsinger Gives VMworld 5 Imperatives for Success
- 3 VMware vSphere Integrated Containers Previewed at VMworld
- 4 Worldwide Server Revenues Top $13.5 Billion in 2Q15
- 5 Blue Box OpenStack Lands on IBM Softlayer Servers
ISAPI Perl Workaround for Unix Conventions Page 6
Since 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: