sub print_html_page_w_ssi { # grab the .html filename passed as a parameter $a = shift; # zap any backslashes in the name # (note: we seem to be on a windows machine) $a =~ s/\\//g; # spiff up the filename, if needed $a = glob($a); # grab its contents (i.e. the html code itself) in $_ $_ = `cat $a`; # print out the http header print "Content-type: text/html\n\n"; # process any ssi tags in $_ one-by-one while ( // ) { # now the name of the ssi file is in $1 # run that file and grab its output in $a $a = `$1`; # put a
with each line terminator $a =~ s/\n/
\n/g; # and substitute that output for # the ssi tag where it occurs in $_ s//$a/; } # print the resulting page (which is still # in $_) to the waiting web client print; }