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

  1. package ActivePerl::DocTools::TOC::HTML;
  2. our $VERSION = '0.10';
  3.  
  4. use strict;
  5. use warnings;
  6. use base ('ActivePerl::DocTools::TOC');
  7.  
  8.  
  9. my $indent = ' ' x 4;
  10.  
  11. # constructs the simpler methods
  12. sub text {
  13.     my ($text) =  join '', map { "$_\n" } @_;
  14.     return sub { $text };
  15. }
  16.  
  17.  
  18. # extra info is tedious to collect -- is done in a subclass or something.
  19. sub extra { '' };
  20.  
  21.  
  22. *header = text ("<hr><p>","<h4>Perl Core Documentation</h4>",);
  23.  
  24. sub before_pods { '' }
  25.  
  26. *pod_separator = text('<br>');
  27.  
  28. sub pod {
  29.     my ($self, $file) = @_;
  30.     return _page($self->{'podz'}->{"Pod::$file"}, $file, $self->extra($file));
  31. }
  32.  
  33. sub after_pods { '' }
  34.  
  35. *before_scripts = text("<hr><p>","<h4>Programs</h4>",);
  36.  
  37. sub script {
  38.     my ($self, $file) = @_;
  39.     return _page($self->{'scriptz'}->{$file}, $file, $self->extra($file));
  40. }
  41.  
  42. sub after_scripts { '' }
  43.  
  44.  
  45. *before_pragmas = text("<hr><p>","<h4>Pragmas</h4>",);
  46.  
  47. sub pragma {
  48.     my ($self, $file) = @_;
  49.     return _page($self->{'pragmaz'}->{$file}, $file, $self->extra($file));
  50. }
  51.  
  52. sub after_pragmas { '' }
  53.  
  54.  
  55. *before_libraries = text("<hr><p>","<h4>Modules</h4>",);
  56.  
  57. *library_indent_open = sub {''};  # text('<ul compact>');
  58. *library_indent_close = sub {''}; # text('</ul>');
  59. *library_indent_same = sub {''};
  60.  
  61. sub library {
  62.     my ($self, $file, $showfile, $depth) = @_;
  63.     return (($indent x $depth) . _page($self->{'filez'}->{$file}, $showfile, $self->extra($file)));
  64. }
  65.  
  66. sub library_container {
  67.     my ($self, $file, $showfile, $depth) = @_;
  68.     return (($indent x $depth) . _folder($showfile));
  69. }
  70.  
  71. sub after_libraries { '' }
  72.  
  73. *footer = text("</div></body></html>");
  74.  
  75.  
  76. sub _folder {
  77.     my ($text) = @_;
  78.     defined $text or die "no argument to _folder!";
  79.     return qq'<img src="images/greysmallbullet.gif" width="5" height="5" alt="*"> $text<br>\n';
  80. }
  81.  
  82. sub _page {
  83.     my ($href, $text, $extra) = @_;
  84.     die "bad arguments to _page: ($href, $text, $extra)" unless (defined $href and defined $text);
  85.     defined $extra or $extra = '';
  86.     if ($extra ne '') {
  87.         $extra = " $extra";  # just to make it EXACTLY identical to the old way. 
  88.     }
  89.     return qq'<img src="images/greysmallbullet.gif" width="5" height="5" alt="*"> <a class="doc" href="$href">$text</a>$extra<br>\n';
  90. }
  91.  
  92.  
  93. sub boilerplate {
  94.     # warn "boilerplate";
  95.     return boiler_header() . boiler_links();
  96. }
  97.     
  98. sub boiler_header {
  99.     # warn "boiler_header";
  100.     return (<<'HERE');
  101. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
  102. <html>
  103.  
  104. <head>
  105. <title>ActivePerl User Guide - Table of Contents</title>
  106. <base target="PerlDoc">
  107. <link rel="STYLESHEET" href="Active.css" type="text/css">
  108. </head>
  109.  
  110. <body>
  111.  
  112. <h1>Table of Contents</h1>
  113. <!-- This is disabled due to a bug somewhere, current suspect is PerlScript
  114. <script language='PerlScript'>
  115.  
  116. #
  117. # An embedded Web server in an HTML page using PerlScript
  118. # This allows HTML documents stored on a hard drive to
  119. # be able to search themselves (on Internet explorer).
  120. #
  121. # Contributed by John Holdsworth (c) 2001.
  122. # patched by http://www.openpsp.org
  123. #
  124. # This code is distriubuted under the 
  125. # "Artistic" license a copy of which 
  126. # is distributed with perl.
  127. #
  128.  
  129. $ID = q$Id: perltoc.pl,v 3.7 2002/02/14 21:50:54 johnh Exp $;
  130.  
  131. use ActivePerl::DocTools::PSP::Searcher;
  132. use vars qw($window);
  133. use IO::File;
  134. use strict;
  135.  
  136. # required for open to work
  137. close STDIN;
  138. close STDOUT;
  139. close STDERR;
  140.  
  141. # log errors to temporary file
  142. my $tmp = (grep -d $_, ($ENV{TEMP}, $ENV{TMP}, "/tmp", "c:\\temp", "c:\\"))[0];
  143. open STDERR, "> $tmp\\perltoc.log" or alert( "Could not open log file in $tmp: $!" );
  144. select STDERR; $| = 1;
  145.  
  146. # server available on this port
  147. my $sock = ActivePerl::DocTools::PSP::Searcher->new( Listen=>5,
  148.     Reuse=>1, LocalPort=>7329, Timeout=>0.000001 )
  149.         or warn "Could not open Socket";
  150. # a zero second timeout is not possible
  151. # using IO::Socket
  152.  
  153. my $port = $sock->sockport();
  154.  
  155.     $window->{document}->write( <<HTML );
  156. <form name='search' method='get' action='http://127.0.0.1:$port/' onsubmit='onsub();'>
  157. <b >Search:</b> <input name='pattern' type='textfield' size='20'
  158. title='Enter a regular expression to search the documentation for.'>
  159. </form>
  160. HTML
  161.  
  162.     $window->{document}{search}{pattern}->focus();
  163.  
  164. # warn "Initialised, \$base: '$base' \$furl: '$furl'";
  165.  
  166. #
  167. # This function is called periodically 
  168. # to poll for incomming connections.
  169. #
  170. sub poll {
  171.     # This will not block as a timeout
  172.     # has been set on the socket.
  173.     $sock->poll(); $@ = '';
  174.  
  175.     # poll again in 100ms using timeout
  176.     $window->setTimeout( "poll()", 100 );
  177. }
  178.  
  179. # start polling for connections
  180. # poll itself calls a timeout so
  181. # a trial accept() is performed
  182. # repeatedly. 
  183.  
  184. poll();
  185.  
  186. sub sendResponse {
  187.     ActivePerl::DocTools::PSP::Searcher::sendResponse();
  188. }
  189.  
  190. sub cb {
  191.     ActivePerl::DocTools::PSP::Searcher::cb();
  192. }
  193.  
  194. </script>
  195. -->
  196. HERE
  197.  
  198. }
  199.  
  200.  
  201. sub boiler_links {
  202.     # warn "boiler_links";
  203.     return (<<HERE);
  204. <div nowrap>
  205.  
  206. <p><strong>Getting Started</strong><br>
  207.  
  208.     <img src="images/greysmallbullet.gif" width="5" height="5" alt="*">
  209. <a class="doc" href="perlmain.html">Welcome To ActivePerl</a><br>
  210.     <img src="images/greysmallbullet.gif" width="5" height="5" alt="*">
  211. <a class="doc" href="RELEASE.html">Release Notes</a><br>
  212.     <img src="images/greysmallbullet.gif" width="5" height="5" alt="*">
  213. <a class="doc" href="install.html">Installation Guide</a><br>
  214.     <img src="images/greysmallbullet.gif" width="5" height="5" alt="*">
  215. <a class="doc" href="readme.html">Getting Started</a><br>
  216.     <img src="images/greysmallbullet.gif" width="5" height="5" alt="*">
  217. <a class="doc" href="CHANGES58.html">ActivePerl 5.8 Change Log</a><br>
  218.     <img src="images/greysmallbullet.gif" width="5" height="5" alt="*">
  219. <a class="doc" href="CHANGES56.html">ActivePerl 5.6 Change Log</a><br>
  220.     <img src="images/greysmallbullet.gif" width="5" height="5" alt="*">
  221. <a class="doc" href="resources.html">More Resources</a><br>
  222.     <img src="images/greysmallbullet.gif" width="5" height="5" alt="*">
  223. <a class="doc" href="Copyright.html">License and Copyright</a><br>
  224.  
  225.  
  226. <strong>ActivePerl Components</strong><br>
  227.  
  228.     <img src="images/greysmallbullet.gif" width="5" height="5" alt="*">
  229. <a class="doc" href="Components/Descriptions.html">Overview</a><br>
  230.     <img src="images/greysmallbullet.gif" width="5" height="5" alt="*">
  231. <a class="doc" href="faq/ActivePerl-faq2.html">PPM</a><br>
  232.  
  233.     <strong>Windows Specific</strong><br>
  234.  
  235.        <img src="images/greysmallbullet.gif" width="5" height="5" alt="*">
  236. <a class="doc" href="OLE-Browser/Browser.html" target="_blank">OLE Browser</a><br>
  237.        <img src="images/greysmallbullet.gif" width="5" height="5" alt="*">
  238. <a class="doc" href="Components/Windows/PerlScript.html">PerlScript</a><br>
  239.        <img src="images/greysmallbullet.gif" width="5" height="5" alt="*">
  240. <a class="doc" href="../eg/IEExamples/index.htm">PerlScript Examples</a><br>
  241.        <img src="images/greysmallbullet.gif" width="5" height="5" alt="*">
  242. <a class="doc" href="Components/Windows/PerlISAPI.html">Perl for ISAPI</a><br>
  243.        <img src="images/greysmallbullet.gif" width="5" height="5" alt="*">
  244. <a class="doc" href="Components/Windows/PerlEz.html">PerlEz</a><br>
  245.  
  246. <strong>ActivePerl FAQ</strong><br>
  247.  
  248.     <img src="images/greysmallbullet.gif" width="5" height="5" alt="*">
  249. <a class="doc" href="faq/ActivePerl-faq.html">Introduction</a><br>
  250.     <img src="images/greysmallbullet.gif" width="5" height="5" alt="*">
  251. <a class="doc" href="faq/ActivePerl-faq1.html">Availability & Install</a><br>
  252.     <img src="images/greysmallbullet.gif" width="5" height="5" alt="*">
  253. <a class="doc" href="faq/ActivePerl-faq2.html">Using PPM</a><br>
  254.     <img src="images/greysmallbullet.gif" width="5" height="5" alt="*">
  255. <a class="doc" href="faq/ActivePerl-faq3.html">Docs & Support</a><br>
  256.  
  257.  
  258.     <strong>Windows Specific</strong><br>
  259.  
  260.        <img src="images/greysmallbullet.gif" width="5" height="5" alt="*">
  261. <a class="doc" href="faq/Windows/ActivePerl-Winfaq2.html">Perl for ISAPI</a><br>
  262.        <img src="images/greysmallbullet.gif" width="5" height="5" alt="*">
  263. <a class="doc" href="faq/Windows/ActivePerl-Winfaq4.html">Windows 9X/NT/2000</a><br>
  264.        <img src="images/greysmallbullet.gif" width="5" height="5" alt="*">
  265. <a class="doc" href="faq/Windows/ActivePerl-Winfaq5.html">Windows Quirks</a><br>
  266.        <img src="images/greysmallbullet.gif" width="5" height="5" alt="*">
  267. <a class="doc" href="faq/Windows/ActivePerl-Winfaq6.html">Web Server Config</a><br>
  268.        <img src="images/greysmallbullet.gif" width="5" height="5" alt="*">
  269. <a class="doc" href="faq/Windows/ActivePerl-Winfaq7.html">Web Programming</a><br>
  270.        <img src="images/greysmallbullet.gif" width="5" height="5" alt="*">
  271. <a class="doc" href="faq/Windows/ActivePerl-Winfaq8.html">Windows Programming</a><br>
  272.        <img src="images/greysmallbullet.gif" width="5" height="5" alt="*">
  273. <a class="doc" href="faq/Windows/ActivePerl-Winfaq9.html">Modules & Samples</a><br>
  274.        <img src="images/greysmallbullet.gif" width="5" height="5" alt="*">
  275. <a class="doc" href="faq/Windows/ActivePerl-Winfaq10.html">Embedding & Extending</a><br>
  276.        <img src="images/greysmallbullet.gif" width="5" height="5" alt="*">
  277. <a class="doc" href="faq/Windows/ActivePerl-Winfaq12.html">Using OLE with Perl</a><br>
  278.  
  279. <strong>Windows Scripting</strong><br>
  280.  
  281.     <img src="images/greysmallbullet.gif" width="5" height="5" alt="*">
  282. <a class="doc" href="Windows/ActiveServerPages.html">Active Server Pages</a><br>
  283.     <img src="images/greysmallbullet.gif" width="5" height="5" alt="*">
  284. <a class="doc" href="Windows/WindowsScriptHost.html">Windows Script Host</a><br>
  285.     <img src="images/greysmallbullet.gif" width="5" height="5" alt="*">
  286. <a class="doc" href="Windows/WindowsScriptComponents.html">Windows Script Components</a></p>
  287.  
  288.  
  289. HERE
  290. }
  291.  
  292.  
  293.