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
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.