The files that you need are as follows:  The actual script.

input.txt:  An example input template.

story.txt:  An example story template.

As with any CGI script, you of course need to be sure that the first
line of points correctly to the location of Perl on your
system, and set it world-executable.

In addition, the following variables will each need to be defined:

$InputFile:  This variable should be defined with the full path to your
input template.

$TextFile:  This variable should be defined with either the full path to
your story template (if you have only one) or the full path to the
directory which contains your story templates (if you have more than

$CGIURL:  This variable should be defined with the URL address of the
WebLibs script.

Obviously, setting up the script isn’t going to present much difficulty.
The trick is setting up your text files so that the script can use them

The input template is the page which users will see when they’re asked
to input the various words which will become part of the story.  It
should be constructed as a standard HTML page, designed in whatever
manner you like so that it will fit the “look” of the rest of your
site.  The only thing you must remember is that at the point where you
want the script to insert the form with the blanks to be filled in, you
need to include, on a line by itself, the comment “<!–InputWords–>”.

Note that you should *not* reference this file directly; rather, the
URL of the script should be referenced.  The script will send the user
a page based on your input template, with the form added.

The story template, of course, is the page with the story.  Like the
input template, it should be designed essentially as a complete HTML
page.  However, at each point where you want a user-input word to be
inserted, put a comment instead, with the description they’ll see on the
input form.  The script will create the input form from the comment
fields it finds in the story, and then will insert the user’s words in
place of those comment fields in the final display.

For example, if your story template includes the line:

John yelled, “<!–Exclamation–>! Your <!–Adjective–> <!–Noun #1–>
is eating my <!–Noun #2–>!”

The user will initially see an input form as follows.  (Note that the
variables in the list will automatically be alphabetized.)

Adjective:  ____________________
Exclamation:  ____________________
Noun #1:  ____________________
Noun #2:  ____________________

If the user were to input, for example, the words “silly,” “Gadzooks,”
“telephone” and “Coke can,” the final display would be:

John yelled, “Gadzooks! Your silly telephone is eating my Coke can!”

(OK, so it’s not the most amusing example I could have come up with.  I
assume you get the idea.)

If you precede a comment field with “a/an” (or “A/an” at the beginning
of a sentence), the script will automatically assign the appropriate
article depending upon the user’s input.  For example, if your story
includes the phrase, “a/an <!–Noun–>”, different users who input
“envelope” and “photograph” will see, respectively, “an envelope” and
“a photograph” in their final stories.


This documentation assumes that you have at least a general familiarity
with setting up Perl scripts.  If you need more specific assistance,
check with your system administrators, consult the WebScripts FAQs
(frequently-asked questions) file <>,
or ask on the WebScripts Forum <>.