Viewing filttest.cgi

#!/usr/local/bin/perl5

use strict;
use CGI;

require '/www/lib/chtml-template.pl';

my $tmpl = $ENV{'SCRIPT_FILENAME'};
$tmpl =~ s{/[^/]*$}{/filttest.tmpl};

my $file = chtml_procfile ($tmpl);
die "can't open $tmpl\n" unless open F, "<$file";

my $str = join '', <F>;
close F;
my $rem = $ENV{'REMOTE_HOST'};
$str =~ s/<!--REMOTE_HOST-->/$rem/g;

my $cgi = new CGI;
print $cgi->header ('-content-length' => length $str), $str;