HyperPerl

HyperPerl is both a program representation, a language, and a translator that prepares programs to be executed. The programs are literate, in that they are embedded within a narrative about their purpose and operation. HyperPerl programs are hosted by wiki and translated from markup to straight script by hp.cgi. wikibase

WikiBase host the HyperPerl translation of the original wiki script. It's literate nature did not turn out to be important to the history of wiki.

I've located the HyperPerl translator in a file, cgi/old/hp, last edited September 30, 1998. I recognize it as a clone of WikiWikiWeb version one with additional functions to prompt for configurations and then to apply those configurations in the emitted code.

Instructions

The code generator operates interactively and starts with the following instructions.

This page provides an interface to the HyperPerl program extractor. If the program you are extracting, $title, includes configuration blanks ([Blank default-value]) then the form below will offer you an opportunity to specify appropriate values for your site.

The links to the right of each field take you to the pages where the blanks appears. Browse from there if you are unsure how to set the parameter.

The Straight Perl button will retrieve the appropriately configured script. Use your browsers Save As ... command to save the script text in an appropriate file.

Enter parameters and configuration choices ...

Then press the following button to generate ...

Implementation

The translator was implemented as two depth-first passes over the hypertext program. The first, browse, created the form described in the instructions.

sub browse { local($title) = pop(@_); $DonePages{$title}++; local (%old) = &retrieve($title); local ($text) = ""; local ($lines) = $old{text}; local ($_); $lines =~ s/\\\n//g; foreach (split(/\n/, $lines)){ next if /^(\t+)(.+):\t/; next if /^(\t+)\*/; next if /^(\t+)\d+\.?/; next if /^\s*$/; next unless s/^\s+//; if (/\[Blank\s*([^\]]*)\]/) { $value = &blank($1); print << ; <input type=text name=$title size=30 value="$value"> in <a href=\"$URL\?$title\"> $title<\/a><br> } while ($_ =~ s/($link)//) { &browse($1) unless $DonePages{$1}; } } }

The second pass, traverse, performed the identical traversal, but this time substituting the parameters from the form into the hypertext code and emitting it as the text output from the request.

sub traverse { local($title) = pop(@_); $DonePages{$title}++; local (%old) = &retrieve($title); local ($text) = ""; local ($lines) = $old{text}; local ($_); $lines =~ s/\\\n//g; foreach (split(/\n/, $lines)){ next if /^(\t+)(.+):\t/; next if /^(\t+)\*/; next if /^(\t+)\d+\.?/; next if /^\s*$/; next unless s/^\s+//; s/\[Blank\s*([^\]]*)\]/&blank($1)/eo; $text .= "$_\n"; while ($_ =~ s/($link)//) { &traverse($1) unless $DonePages{$1}; } } print "$text# ------------------- $title\n" if $text; }