home *** CD-ROM | disk | FTP | other *** search
/ Chip: Windows 2000 Professional Resource Kit / W2KPRK.iso / apps / perl / ActivePerl.exe / data.z / session1.asp < prev    next >
Encoding:
Text File  |  1999-10-14  |  1.6 KB  |  59 lines

  1. <%@ LANGUAGE = PerlScript%>
  2. <HTML>
  3. <HEAD>
  4. <!-- 
  5.     Copyright (c) 1996, Microsoft Corporation.  All rights reserved.
  6.     Developed by ActiveState Internet Corp., http://www.ActiveState.com
  7. -->
  8. <TITLE>Active Server Pages - Perl Version</title>
  9. </HEAD>
  10. <BODY>
  11. <BODY BGCOLOR=#FFFFFF>
  12.  
  13. <!-- 
  14.     ActiveState PerlScript sample 
  15.     PerlScript:  The coolest way to program custom web solutions. 
  16. -->
  17.  
  18. <!-- Masthead -->
  19. <TABLE CELLPADDING=3 BORDER=0 CELLSPACING=0>
  20. <TR VALIGN=TOP ><TD WIDTH=400>
  21. <A NAME="TOP"><IMG SRC="PSBWlogo.gif" WIDTH=400 HEIGHT=48 ALT="ActiveState PerlScript" BORDER=0></A><P>
  22. </TD></TR></TABLE>
  23.  
  24. <HR>
  25.  
  26. <H3>Active Server Session Object</H3>
  27. <br>
  28.  
  29. <%
  30.     # get the value associated with 'MyVar'
  31.     # increment the value then store it back
  32.     $var = $Session->{'MyVar'};
  33.     $var++;
  34.     $Session->{'MyVar'} = $var;
  35.  
  36.     # let the user know what the value of the variable is
  37.     $Response->write("The value of the session variable MyVar is $var after being incremented");
  38. %>
  39.  <br>
  40.  <br>
  41.  <a href="session2.asp">Click here to see another page access the session variable MyVar.</a>
  42.  
  43. <!-- +++++++++++++++++++++++++++++++++++++
  44. here is the standard showsource link - 
  45.     Note that PerlScript must be the default language --> <hr>
  46. <%
  47.     $url = $Request->ServerVariables('PATH_INFO')->item;
  48.     $_ = $Request->ServerVariables('PATH_TRANSLATED')->item;
  49.     s/[\/\\](\w*\.asp\Z)//m;
  50.     $params = 'filename='."$1".'&URL='."$url";
  51.     $params =~ s#([^a-zA-Z0-9&_.:%/-\\]{1})#uc '%' . unpack('H2', $1)#eg;
  52. %>
  53. <A HREF="index.htm"> Return </A>
  54. <A HREF="showsource.asp?<%=$params%>">
  55. <h4><i>view the source</i></h4></A>  
  56.  
  57. </BODY>
  58. </HTML>
  59.