The code below does as you ask. It opens an existing html file, prints it and then runs your script.
use strict;
use warnings;
open(FH,"<./test.html") || die "couldn't open file $!\n";
my @html=<FH>;
close(FH);
print @html;
print " my script stuff<P>\n";
print '</body>';
As monkfish suggests a server side include may also do what you want.
You would put the following line inside your html document
<!--#exec cgi="/cgi-bin/yourscript.pl" -->
Some random personal SSI thoughts:
- Microsoft IIS is more forgiving of syntax sloppiness. For example you can have a space between the -- and the # This can cause problems when you switch to apache.
- Your server has to have SSI enabled and has to allow exec commands. Allowing any user to execute any command in their page is considered a security risk.
- As far as I know, there is not a portable way to pass your CGI parameters. Apache supports environment variables. IIS supports a parameter string but not vice versa
Hope this helps
--mandog |