home *** CD-ROM | disk | FTP | other *** search
/ Netrunner 2004 October / NETRUNNER0410.ISO / regular / ActivePerl-5.8.4.810-MSWin32-x86.msi / _8527efaf354d638f3a3134c8b4387e44 < prev    next >
Text File  |  2004-06-01  |  9KB  |  191 lines

  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
  2.  
  3. <HTML>
  4.  
  5. <HEAD>
  6. <TITLE>PerlScript</TITLE>
  7. <LINK rel="STYLESHEET" href="../../Active.css" type="text/css">
  8. </HEAD>
  9.  
  10. <BODY>
  11.  
  12. <table width="100%" border="0" cellspacing="0" cellpadding="0" bgcolor="#EAE2BB">
  13. <tr> 
  14. <td width="57"><a target=_blank href="http://www.ActiveState.com/ActivePerl/">
  15. <img src="../../images/activeperl_logo.gif" width="57" height="48" border="0" alt="ActivePerl"></a></td>
  16. <td><div align="center" class="heading">ActivePerl User Guide</div></td>
  17. <td width="112"><a target=_blank  href="http://www.ActiveState.com">
  18. <img src="../../images/AS_logo.gif" width="112" height="48" border="0"  alt="ActiveState" /></a></td>
  19. </tr>
  20. <tr>
  21. <td class="lineColour" colspan="3"></td>
  22. </tr>
  23. </table>
  24.  
  25. <h1>PerlScript</h1>
  26. <UL>
  27.   <LI><a class="doc" href="#what_is_perlscript">What is PerlScript?</A>
  28.   <LI><a class="doc" href="#running_perlscript">What do I need to run PerlScript?</A>
  29.   <LI><a class="doc" href="#how_do_i_install_perlscript">How do I install PerlScript?</A>
  30.   <LI><a class="doc" href="#case_sensitive_event_names">Why aren't my event handlers called?</A>
  31.   <LI><a class="doc" href="#windows_scripting_host">What is Windows Script Host?</A>
  32.   <LI><a class="doc" href="#active_server_pages">Can I write Active Server Pages with PerlScript?</A>
  33.   <LI><a class="doc" href="#active_server_pages_why">What can I do when PerlScript in ASP seems capsized in PWS?</A>
  34.   <LI><a class="doc" href="#global_asa">What is Global.asa to ASP and PerlScript?</A>
  35.   <LI><a class="doc" href="#client_side">Client-side PerlScript</A>
  36.   <LI><a class="doc" href="#perlscript_configuration">How can I configure client-side PerlScript security?</A>
  37.   <LI><a class="doc" href="#other_references">Other References</A>
  38. </UL>
  39.  
  40. <h2><A name="what_is_perlscript">What is PerlScript?</A></h2>
  41. <P>PerlScript is an ActiveX scripting engine that allows you to use Perl with any ActiveX scripting
  42. host. At this time, ActiveX scripting hosts include:</P>
  43. <UL>
  44.   <LI>Internet Information Server 3.0/4.0/5.0
  45.   <LI>Peer Web Services 3.0/4.0
  46.   <LI>Microsoft Internet Explorer 5.0x
  47.   <LI>Windows Scripting Host
  48. </UL>
  49.  
  50. <h2><A name="running_perlscript">What do I need to run PerlScript?</A></h2>
  51. <UL>
  52.   <LI>ActivePerl
  53.   <LI>an ActiveX scripting host (<a class="doc" href="#what_is_perlscript">see above</a>)
  54.   <LI>Windows 2000/NT/9x
  55.   <LI>Perl scripts!
  56. </UL>
  57.  
  58. <h2><A name="how_do_i_install_perlscript">How do I install PerlScript?</A></h2>
  59. <P>When you launch the ActivePerl installer, PerlScript is one of the components you
  60. can optionally install. You must install, or have previously installed, ActivePerl to use
  61. PerlScript.
  62.  
  63. <h2><A name="case_sensitive_event_names">Why aren't my event handlers called?</A></h2>
  64. <P>Case sensitive lookup of event names may be being performed. Event name lookup can be made case
  65. insensitive by adding key
  66. <UL>
  67.   HKEY_LOCAL_MACHINE\SOFTWARE\ActiveState\PerlScript\1.0<BR>
  68.   REG_DWORD: NoCaseCompare = 1 (default)
  69. </UL>
  70.  
  71. <h2><A name="windows_scripting_host">What is Windows Script Host?</a></h2>
  72. <P>Microsoft advertises Windows Script Host, or WSH for short, as being "a
  73. language-independent scripting host for 32-bit Windows operating system platforms".
  74. WSH offers a lot to VBScript and JScript developers for whom console type programs have
  75. been traditionally difficult. For Perl Developers, however, the same functionality can be found
  76. with a Perl module or extension.</p>
  77. <p>More information can be found in the Windows Script Host tutorial.
  78.  
  79. <h2><A name="active_server_pages">What do I need to write Active Server Pages with PerlScript?</a></h2>
  80. <P>Active Server Pages, or ASP for short, is a server-side technology that
  81. enables you to embed script commands within HTML. ActivePerl and PerlScript are required on the server
  82. that is providing the webpages, but the two are not required on the client; however, would you be
  83. developing Active Server Pages on your local machine, you are, of course, both the client and the server. </P>
  84.  
  85. <p>For a web server, Windows 95 users will need the Personal Web Server (PWS), which is freely downloadable
  86. as a component included in the NT Option Pack available from <a class="doc" href="http://www.microsoft.com">Microsoft</a>. 
  87.  
  88. <p>Windows 98 users will need to either install it from the CD that comes with Windows 98 or download the
  89. NT Option pack. Windows NT/2000 users will either get it installed out of the box under the name Internet
  90. Information Services or need to install it off from the CD. </p>
  91.  
  92. <p>For more information about how to use the technology, see the Active Server Pages tutorial.
  93.  
  94. <h2><A name="active_server_pages_why">What can I do when PerlScript in ASP seems capsized in PWS?</a></h2>
  95. <P>There are three widely used solutions when PerlScript and ASP doesn't function the way it should in PWS.
  96. First, reboot the computer and see if it works; next, reinstall ActivePerl with PerlScript checked and see if it works;
  97. lastly, reinstall PWS if none of the above works. Oftentimes, when somebody has a problem with PWS, it is
  98. commonly asked if the person has set "scripts" permissions on the server so that a scripting language is enabled
  99. to run. PWS and IIS sets the majority, if not all, virtual directories to allow scripts by default, so do not worry
  100. yourself about that; instead, follow the guidelines laid out above. 
  101.  
  102.  
  103. <h2><A name="global_asa">What is Global.asa to ASP and PerlScript?</A></h2>
  104. <P>
  105. Global.asa is a file that exists for each IIS application. On PWS, there is only one IIS application while later versions
  106. of the IIS web-server supports many more IIS applications. Global.asa can be used to declare objects that are
  107. given either Session or Application scope within the web service. It must as a skeleton without code look as follows:
  108. <ul><code>
  109. <script language=perlscript runat=server>
  110. <BR>sub Application_OnStart {
  111. <BR>}
  112. <BR>
  113. <BR>sub Application_OnEnd {
  114. <BR>}
  115. <BR>
  116. <BR>sub Session_OnStart {
  117. <BR>}
  118. <BR>
  119. <BR>sub Session_OnEnd {
  120. <BR>}
  121. <BR></script>
  122. </code></ul>
  123. <p>Then you can put code within the subroutines that creates variables, objects, and so forth. The subroutines, or
  124. events, will be called at their designated times: Session_OnStart when a new session is started, and its OnEnd event
  125. is run when the session is ended. The Application's start and end signifies the start and stop of the webserver.
  126.  
  127. <h2><A name="client_side">Client-side PerlScript</A></h2>
  128. <P>Client-Side PerlScript has Perl embedded within your HTML documents. All PerlScript code must be
  129. contained within <CODE><SCRIPT LANGUAGE="PerlScript"> </SCRIPT></CODE>
  130. <P>Client-side PerlScript has the added requirement that both ActivePerl and PerlScript be installed
  131. on each computer will will be loading PerlScript pages.
  132. <P>Client-side Perlscript should only be used if you can control the ocnfiguration of the computers
  133. on which it will be run. If your goal is build an application which will be used by a large number
  134. users, Server-side PerlScript is considerably more practical.
  135. <P>To display something to the browser, use the <CODE>write()</CODE> method of the document object.
  136. You can use the <CODE>write()</CODE> method with <CODE>$windows->document->write('any old
  137. text')</CODE>.
  138. <P>The sample below is another Hello World variation, but this time using client-side PerlScript:
  139. <UL>
  140.   <CODE><HTML><BR>
  141.   <HEAD><BR>
  142.   <TITLE>PerlScript Hello World!</TITLE><BR>
  143.   </HEAD><BR>
  144.   <BODY BGCOLOR="#FFFFFF"><BR>
  145.   <h2>PerlScript Hello world!</h2><BR>
  146.   <SCRIPT LANGUAGE="PerlScript"><BR>
  147.   $window->document->write('Hello world!');<BR>
  148.   </SCRIPT><BR>
  149.   </BODY><BR>
  150.   </HTML><BR>
  151.   </CODE>
  152. </UL>
  153.  
  154. <h2><A name="perlscript_configuration">How can I configure client-side PerlScript security?</A></h2>
  155. <P>PerlScript in IE 4.0 and higher can be enabled/disabled by zones
  156. <UL>
  157.   HKEY_LOCAL_MACHINE\SOFTWARE\ActiveState\PerlScript\1.0<BR>
  158.   REG_DWORD: EnabledZones = 0x0010 (default)
  159. </UL>
  160. <P><STRONG>Values</STRONG>
  161. <UL>
  162.   <LI>Enable All 0x0001
  163.   <LI>Enable Local 0x0010
  164.   <LI>Enable Internet 0x0020
  165.   <LI>Enable Trusted 0x0040
  166.   <LI>Enable Restricted 0x0080 (for the perverse)
  167. </UL>
  168.  
  169. <p>IE3 is more limited; it is an all or nothing affair. For IE3 the only values recognized are
  170. <P><STRONG>Values</STRONG>
  171. <UL>
  172.   <LI>Disable All 0x0000
  173.   <LI>Enable All 0x0001
  174. </UL>
  175.  
  176. <h2><A name="other_references">Other References</A></h2>
  177. <P>Another PerlScript FAQ available on the net can be found at:  
  178. <UL>
  179.   <LI><a class="doc" href="http://www.fastnetltd.ndirect.co.uk/Perl/perl-win32-asp.html"><B>The Perl-Win32-ASP
  180.     FAQ</B></A>. Maintained by Matthew Sergeant.</LI>
  181. </UL>
  182. <TABLE border="0" cellpadding="0" cellspacing="0" width="100%">
  183.   <TR>
  184.     <TD class="block" valign="MIDDLE" width="100%" bgcolor="#cccccc"><STRONG>
  185.       <P class="block"> PerlScript</P>
  186.       </STRONG></TD>
  187.   </TR>
  188. </TABLE>
  189.  
  190. </BODY>
  191.