What is PerlScript?

PerlScript is an Active Scripting engine that allows you to use Perl with any Active Scripting host. Active Scripting hosts include:

  • Microsoft Internet Information Server (IIS)
  • Peer Web Services
  • Microsoft Internet Explorer
  • Windows Scripting Host

What do I need to run PerlScript?

  • ActivePerl
  • an ActiveX scripting host (see above)
  • Windows Vista/XP/200x/9x/Me
  • Perl scripts!

How do I install PerlScript?

When you launch the ActivePerl installer, PerlScript is one of the components you can optionally install. To use PerlScript, ActivePerl must be installed.

Why aren't my event handlers called?

It is possible that case sensitive lookups of event names are being performed. Event name lookups can be made case insensitive by adding the key

    REG_DWORD: NoCaseCompare = 1 (default)
to the Registry.

What is Windows Script Host?

Microsoft advertises Windows Script Host (WSH) as being "a language-independent scripting host for 32-bit Windows operating system platforms". WSH offers a lot to VBScript and JScript developers for whom console type programs have traditionally been difficult to work with. For Perl Developers, the same functionality can be found with a Perl module or extension.

More information can be found in the Windows Script Host tutorial.

What do I need to have so that I can write Active Server Pages with PerlScript?

Active Server Pages, or ASP for short, is a server-side technology that enables you to embed script commands within HTML. ActivePerl and PerlScript are required on the webserver that is providing the webpages, but are not required on the client. However, remember that if you develop Active Server Pages on your local machine, your system is considered to be both the client and the server.

In order to have a web server on Windows 95, users will need the Personal Web Server (PWS), which is freely downloadable as a component included in the NT Option Pack available from Microsoft.

Windows 98/Me users will need to either install this from the CD that comes with Windows 98/Me or download the NT Option pack. Windows XP Pro/NT/200x users will either find it already installed under the name "Internet Information Services", or else they can install it from the CD that came with Windows XP Pro/NT/200x.

Windows XP Home users will need to install the Apache webserver; Windows IIS and PWS are not supported on Windows XP Home.

For more information about how to use the technology, see the Active Server Pages tutorial.

What can I do when PerlScript in ASP seems to work unpredictably in Personal Web Server (PWS)?

There are three widely used solutions when PerlScript and ASP don't function correctly in PWS:

  • Reboot the computer and see if it works
  • Reinstall ActivePerl with PerlScript checked and see if it works
  • If the previous steps fail, reinstall PWS.
PWS and IIS generally set the permissions on virtual directories to allow scripting by default, it is rarely necessary to alter "scripts" permissions on directories. The steps above will solve most problems with scripting.

How does Global.asa relate to ASP and PerlScript?

Global.asa is a file that exists for each IIS application. On PWS, there is only one IIS application, while later versions of the IIS web-server support a number of different IIS applications. Global.asa can be used to declare objects that are given either Session or Application scope within the web service. This should be similar to the following code:

    <script language=perlscript runat=server>
    sub Application_OnStart {

    sub Application_OnEnd {

    sub Session_OnStart {

    sub Session_OnEnd {

Then you can put code within the subroutines that create variables, objects, and so forth. The subroutines, or events, will be called at their designated times: Session_OnStart is run when a new session is started, and its OnEnd event is run when the session is ended. The application's start and end signifies the starting and stopping of the webserver.

Client-side PerlScript

Client-Side PerlScript is Perl embedded within your HTML documents. All PerlScript code must be contained between <script language="PerlScript"> and </script> tags.

Client-Side PerlScript also has the added requirement that both ActivePerl and PerlScript must be installed on each computer that will be loading PerlScript pages.

Client-side Perlscript should only be used if you can control the configuration of the computers on which it will be run. If your goal is to build an application that will be used by a large number of users, server-side PerlScript is considerably more practical.

To display something in the browser, use the document object method write(). You can use the write() method with $windows->document->write('any old text').

The sample below is another Hello World variation, but this time using client-side PerlScript:

    <title>PerlScript Hello World!</title>
    <body bgcolor="#ffffff">
    <h2>PerlScript Hello world!</h2>
    <script language="PerlScript">
    $window->document->write('Hello world!');

How can I configure client-side PerlScript security?

PerlScript in IE 4.0 and higher can be enabled/disabled by zones

    REG_DWORD: EnabledZones = 0x0010 (default)


  • Enable All 0x0001
  • Enable Local 0x0010
  • Enable Internet 0x0020
  • Enable Trusted 0x0040

Note: By default, PerlScript is only enabled in IE's Local zone. Enabling PerlScript any other zones is not recommended. It allows websites to execute Perl code on the local machine as the current user.

Other References

Another PerlScript FAQ available on the net can be found at: