Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

166 lines
3.9 KiB

  1. <%@ LANGUAGE = PerlScript%>
  2. <html>
  3. <head>
  4. <meta name="GENERATOR" content="ActiveState_Hack = Dick Hardt">
  5. <!--
  6. Copyright (c) 1996, Microsoft Corporation. All rights reserved.
  7. Developed by ActiveState Internet Corp., http://www.ActiveState.com
  8. -->
  9. <title>Dump PerlScript's Variables</title>
  10. </head>
  11. <body>
  12. <BODY BGCOLOR=#FFFFFF>
  13. <!--
  14. ActiveState PerlScript sample
  15. PerlScript: The coolest way to program custom web solutions.
  16. -->
  17. <!-- Masthead -->
  18. <TABLE CELLPADDING=3 BORDER=0 CELLSPACING=0>
  19. <TR VALIGN=TOP ><TD WIDTH=400>
  20. <A NAME="TOP"><IMG SRC="PSBWlogo.gif" WIDTH=400 HEIGHT=48 ALT="ActiveState PerlScript" BORDER=0></A><P>
  21. </TD></TR></TABLE>
  22. <%
  23. #
  24. # here are some variables and functions defined
  25. # just so we can see them in the dump
  26. #
  27. $MyForm::var5= "MyForm::var5";
  28. $YourForm::var5= "YourForm::var5";
  29. $myScalar = "Scalar String";
  30. $myLongString = "Here is a long string that goes on and on and on and on and on and on and on";
  31. $myHash{red}="apple";
  32. $myHash{green}="pear";
  33. $myHash{black}="olive";
  34. @myArray=('one','two','three');
  35. sub foo ($$$)
  36. {
  37. my ($a,$b,$c) = @_;
  38. }
  39. sub MyForm::foo($$$)
  40. {
  41. my ($a,$b,$c) = @_;
  42. }
  43. %>
  44. <h2> Dump PerlScript's Variables </h2>
  45. <hr>
  46. <PRE>
  47. <code>
  48. <% DumpPerlNames(); %>
  49. </code></pre>
  50. <hr>
  51. <h2> ... That's all folks! </h2>
  52. <script language=PerlScript RUNAT=Server>
  53. # Perl Variable tree dump
  54. sub strip{
  55. my $str = $_[0];
  56. $str =~ s/</&lt/g;
  57. $str =~ s/>/&gt/g;
  58. $str =~ s/[\x00-\x1F]/<b>.<\/b>/g;
  59. return $str;
  60. }
  61. sub DumpNames(\%$)
  62. {
  63. my ($package,$packname) = @_;
  64. my $symname = 0;
  65. my $value = 0;
  66. my $key = 0;
  67. my $i = 0;
  68. if ($packname eq 'main::') {
  69. $Response->write("<H2>Packages</H2>\n");
  70. foreach $symname (sort keys %$package) {
  71. local *sym = $$package{$symname};
  72. $Response->write("\t<A HREF=#Package_$symname>$symname</A>\n") if ((defined %sym) && ($symname =~/::/));
  73. }
  74. }
  75. $Response->write("<H2>\n<a name=\"Package_$packname\"::>Package $packname</a>\n</H2>"); #Scalars Lists Hashes Functions
  76. $Response->write("$packname Scalars\n");
  77. foreach $symname (sort keys %$package) {
  78. local *sym = $$package{$symname};
  79. if (defined $sym) {
  80. #$value = ' 'x(length($symname) - 30)."\$$symname";
  81. #$value = $value."\t=".((length($sym) > 40) ? sprintf("%37.37s...",$sym) : $sym);
  82. $value = "\t\$".strip($symname)."\t".strip($sym)."\n";
  83. $Response->write($value);
  84. }
  85. }
  86. $Response->write("$packname Functions\n");
  87. foreach $symname (sort keys %$package) {
  88. local *sym = $$package{$symname};
  89. $Response->write("\t$symname()\n") if defined &sym;
  90. }
  91. $Response->write("$packname Lists\n");
  92. foreach $symname (sort keys %$package) {
  93. local *sym = $$package{$symname};
  94. $Response->write("\t\@$symname\n") if defined @sym;
  95. }
  96. $Response->write("$packname Hashes\n");
  97. foreach $symname (sort keys %$package) {
  98. local *sym = $$package{$symname};
  99. $Response->write("\t\@$symname\n") if ((defined %sym) && !($symname =~/::/));
  100. }
  101. $Response->write("\n");
  102. if ($packname ne 'main::') {
  103. return;
  104. }
  105. foreach $symname (sort keys %$package) {
  106. local *sym = $$package{$symname};
  107. DumpNames(\%sym,$symname) if ((defined %sym) && ($symname =~/::/) && ($symname ne 'main::'));
  108. }
  109. }
  110. sub DumpPerlNames
  111. {
  112. DumpNames(%main::,'main::');
  113. }
  114. </script>
  115. <!-- +++++++++++++++++++++++++++++++++++++
  116. here is the standard showsource link -
  117. Note that PerlScript must be the default language --> <hr>
  118. <%
  119. $url = $Request->ServerVariables('PATH_INFO')->item;
  120. $_ = $Request->ServerVariables('PATH_TRANSLATED')->item;
  121. s/[\/\\](\w*\.asp\Z)//m;
  122. $params = 'filename='."$1".'&URL='."$url";
  123. $params =~ s#([^a-zA-Z0-9&_.:%/-\\]{1})#uc '%' . unpack('H2', $1)#eg;
  124. %>
  125. <A HREF="index.htm"> Return </A>
  126. <A HREF="showsource.asp?<%=$params%>">
  127. <h4><i>view the source</i></h4></A>
  128. </body>
  129. </html>