Most web pages on hce.research.bell-labs.com web pages are dynamically generated, and are customized for the viewer. They are created by perl scripts, with a subroutine package that allows you to embed small swatches of perl code in your HTML, rather than having to print out all that HTML from perl by hand. Don't do this:

print "<H1>Source Code</H1>\n";
Instead, do this:

<H1>Source Code</H1>
Perl code is enclosed in <PERL> and </PERL> delimiters. You can switch in and out sections of HTML: if your perl code returns zero (or blank string), the next section of HTML is ignored. Otherwise, it is output. For example:

$number_of_gerbils > 0;
Here's how to care for your
<A HREF="http://www.gerbils.com/care">Gerbil</A>...
Will only explain gerbil care if you have a positive number of gerbils.

Variable substitution in the HTML text is also possible. Any word beginning with a single dollar sign is treated as a perl scalar variable. Double dollar sign produces a dollar sign. The following example will produce "The value of 'a' is 34.".

$a = 34;
The value of 'a' is $a.

Equivalently, the tag <PERLSUB a> will be replaced with the value of 'a'.

The subroutines support selection of valid users by IP address for low-security applications, where passwords aren't worth the bother. You can have a file that lists IP addresses and associated names; the client_ok() function returns true if the IP address is recognized, or false if not (also see):

Stuff here that should be seen only by recognized users...

This function library also provides a simple, robust, method of passing information from one hypertext page to another. This can be used to preserve state information from script to script, allowing a user to preserve a URL that will always return him to the same point in a sequence. The function decode_pi() to convert that string back into a hash table, so it can be easily accessed in perl.

# in the sending script:
$p_info = encode_pi({'key'=>'value', 'food'=>'ice cream'});
<A HREF="http://www.xxx.yy/cgi-bin/script/$p_info">anchor text</A>

# in the recieving script:

%pairs = {};
decode_pi($ENV{'PATH_INFO'}, \%pairs);
... since your favorite food is $food ...

Finally, it also will automatically produce HTML headers and footers with all the bells and whistles, including information to control cacheing, backgrounds and more.

Lab1123 Homepage

These files date to 9/5/1998, and are the slides for a talk presented at Bell Laboratories, Holmdel, NJ on that date, or perhaps the next day.