#! /usr/bin/perl
use strict;
use CGI;
my $cgi = new CGI;
my $file = $ENV{DOCUMENT_URI};
$file =~ s|^/||;
$| = 1; # turn off output buffering and print out content header
print "Content-type: text/html\n\n";
# Set our variables from the CGI
my %vars;
$vars{background} = $cgi->param('background') || "#119511";
$vars{root} = $cgi->param('root') || $file =~ m|^(~[^/]+/?)|?"/$1":"/";
$vars{title} = $cgi->param('title') || "CTL";
$vars{separator} = $cgi->param('separator') || ' => ';
####################################
#Create the title bar
#Process the beginning of the header
my $header = "\n" .
$vars{title} . '';
#don't process the file's name
my @components = split('/', $file);
my $tail = pop @components;
if ($tail =~ m|index\.s?html?|i) {
$tail = pop @components;
}
#If this is in a home directory, we've already added that in.
shift @components if $file =~ m|^~|;
#build the inbetween stuff
my $path;
foreach my $foo (@components) {
next if $foo !~ /\S/;
$path .= "$foo/";
my $newfoo = ucfirst $foo;
$newfoo =~ s|_| |go;
$newfoo =~ s|\.s?html?$||gio;
$header .= "$vars{separator} $newfoo ";
}
#Add on the name of the file
if ($tail ne '') {
$tail =~ s|\.s?html?||io;
$tail =~ s|_| |go;
$tail = ucfirst $tail;
$header .= "$vars{separator} $tail ";
}
####################
#Get the URLs right
$header =~ s|//|/|go;
$header =~ s|tp:/(?!/)|tp://|gio;
$header .= "\n";
#and finally print the thing.
print $header;
Short Literary works
Below are some of my favorite short literary works.