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:

  1. 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.

  2. 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.

  3. 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


In reply to Re: Append script output to complex block of html and script by mandog
in thread Append script output to complex block of html and script by jerrygarciuh

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • 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:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.