Migrating a Web Server to IIS 5.0 |
Here are some issues you might encounter when migrating a Perl script from a UNIXbased Web server to IIS 5.0.
If you plan to use the Perl for Win32 script interpreter to run UNIX Perl scripts, you might need to make modifications to ensure the scripts run correctly. When reading a text file from a disk, Windows translates \r\n
into \n
, and reads ^Z
as an end-of-file marker, but it doesn’t use any such translation for binary files. For some Perl interpreters, the C run-time library opens files in text mode by default. For binary data, you should specify binary mode for the file handle by using the binmode function. For more information about doing this, see the perlfunc documentation.
When migrating a Perl script from UNIX, remember that Windows uses the backslash (\
) character as a delimiter for paths in a file name, for example, c:\path\somefile.txt. Because Perl uses the backslash as an escape code, to symbolize a special character such as the line feed character (\n
) or the tab character (\t
), an error results if you attempt to open a file in this manner:
Open( MYFILE, "C:\path\somefile.txt" )
To resolve this problem, you can replace each backslash with a double backslash (\\
), in order to indicate an actual backslash rather than the introduction of a special character. Or you can use noninterpolating single quote strings in order to indicate there are no special characters in the string, as follows:
Open( MYFILE, 'C:\path\somefile.txt' );