It is not entirely clear to me what you are trying to accomplish. Do you want to run this script from your web browser -- that is, as a CGI program -- and see the output, or are you just looking for a better way to format HTML output that will be dumped into your output file to be viewed later in a web browser?

If the former, you will need a way to provide the information to your CGI script that you're currently getting from the command line. The best way to do this is with the CGI.pm module.

The CGI module can also help you with your output, but making it easy to print the headers and HTML that you need. Alternately, you could use a template system like HTML::Template or Template Toolkit.

I know you said that you don't want to re-write your code, but sometimes a little re-writing is necessary to add functionality or get things working the way you want. Using a template system would also make future changes and maintenance to your code far easier and less error-prone.

If you're really dead-set against rewriting anything, but you want to run this as a CGI program, you would need to just hard-code your command-line parameters (or use CGI.pm to get them from GET or POST parameters) and add a header output line -- minimally print "Content-type: text/html\n\n" -- somewhere before you start outputting HTML.


In reply to Re: Formmating Mysql Health check script output. by Cubes
in thread Formmating Mysql Health check script output. by aalneyperl

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.