![]() |
ActivePerl User Guide |
![]() |
PerlScript is an ActiveX scripting engine that allows you to use Perl with any ActiveX scripting host. At this time, ActiveX scripting hosts include:
When you launch the ActivePerl installer, PerlScript is one of the components you can optionally install. You must install, or have previously installed, ActivePerl to use PerlScript.
Case sensitive lookup of event names may be being performed. Event name lookup can be made case insensitive by adding key
Microsoft advertises Windows Script Host, or WSH for short, 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 been traditionally difficult. For Perl Developers, however, the same functionality can be found with a Perl module or extension.
More information can be found in the Windows Script Host tutorial.
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 server that is providing the webpages, but the two are not required on the client; however, would you be developing Active Server Pages on your local machine, you are, of course, both the client and the server.
For a web server, 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 users will need to either install it from the CD that comes with Windows 98 or download the NT Option pack. Windows NT/2000 users will either get it installed out of the box under the name Internet Information Services or need to install it off from the CD.
For more information about how to use the technology, see the Active Server Pages tutorial.
There are three widely used solutions when PerlScript and ASP doesn't function the way it should in PWS. First, reboot the computer and see if it works; next, reinstall ActivePerl with PerlScript checked and see if it works; lastly, reinstall PWS if none of the above works. Oftentimes, when somebody has a problem with PWS, it is commonly asked if the person has set "scripts" permissions on the server so that a scripting language is enabled to run. PWS and IIS sets the majority, if not all, virtual directories to allow scripts by default, so do not worry yourself about that; instead, follow the guidelines laid out above.
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 supports many more IIS applications. Global.asa can be used to declare objects that are given either Session or Application scope within the web service. It must as a skeleton without code look as follows:
<script language=perlscript runat=server>
sub Application_OnStart {
}
sub Application_OnEnd {
}
sub Session_OnStart {
}
sub Session_OnEnd {
}
</script>
Then you can put code within the subroutines that creates variables, objects, and so forth. The subroutines, or events, will be called at their designated times: Session_OnStart 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 start and stop of the webserver.
Client-Side PerlScript has Perl embedded within your HTML documents. All PerlScript code must be
contained within <SCRIPT LANGUAGE="PerlScript"> </SCRIPT>
Client-side PerlScript has the added requirement that both ActivePerl and PerlScript be installed on each computer will will be loading PerlScript pages.
Client-side Perlscript should only be used if you can control the ocnfiguration of the computers on which it will be run. If your goal is build an application which will be used by a large number users, Server-side PerlScript is considerably more practical.
To display something to the browser, use the write()
method of the document object.
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:
<HTML>
<HEAD>
<TITLE>PerlScript Hello World!</TITLE>
</HEAD>
<BODY BGCOLOR="#FFFFFF">
<h2>PerlScript Hello world!</h2>
<SCRIPT LANGUAGE="PerlScript">
$window->document->write('Hello world!');
</SCRIPT>
</BODY>
</HTML>
PerlScript in IE 4.0 and higher can be enabled/disabled by zones
Values
IE3 is more limited; it is an all or nothing affair. For IE3 the only values recognized are
Values
Another PerlScript FAQ available on the net can be found at:
PerlScript |