Suggestion 1 - provide a command line option to have the program print the header. That way, scripts can ask it to provide the header, if it hasn't been printed yet, or tell it to not bother, if it already has been handled. The calling script might even want one version in one situation, and the other in another.

Suggestion 2 - have the program return a text string to the calling cgi, rather than sending it to the remote client. That way the invoking cgi script can determine what happens. In an extreme case, you might merely want to know how many characters were used to represent the message.

As Occam said: Entia non sunt multiplicanda praeter necessitatem.


In reply to Re: Don't reprint header by TomDLux
in thread Don't reprint header by erpence

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.