- Click Start, click Programs, click Administrative Tools, and then click Internet Information Services.
- Right-click a Web site that you want to enable PERL for, and then click Properties.
- Click the Home Directory tab.
- Click Configuration.
- Click Add.
- In the Executable box, type the following:
full path to\perl.exe %s %s
Note The “%s %s” is case sensitive (for example, “%S %S” does not work).
- In the Extension box, type .pl. Note Make sure that the All Verbs option is selected for full functionality. Also, make sure that the Script Engine check box is selected.
- Click OK to return to the ISM.
- Click the Web Service Extensions folder.
- Click Add a new Web service extension.
- Type a name for the extension, such as “PERL Scripts.”
- Click Add, type the full path to the Perl.exe file, and then click OK.
- Make sure that the Set extension status to Allowed check box is selected.
- Click OK to return to the ISM. With the IIS default scripts directory, the URL is the following:
http://Server Name/scripts/helloworld.pl
- save below as helloworld.pl
$url = "http://$ENV{SERVER_NAME}$ENV{URL}";
$ip = "$ENV{REMOTE_ADDR}";
print <<ENDOFTEXT;
HTTP/1.0 200 OK
Content-Type: text/html
<HTML>
<HEAD><TITLE>Hello World!</TITLE></HEAD>
<BODY>
<H4>Hello World!</H4>
<P>You have reached <a href="$url">$url</a></P>
<P>Your IP Address is $ip</P>
<H5>Have a nice day!</H5>
</BODY>
</HTML>
ENDOFTEXT
exit(0);