P is for Practical | |
PerlMonks |
Re: Formmating Mysql Health check script output.by Cubes (Pilgrim) |
on Dec 06, 2007 at 16:41 UTC ( [id://655453]=note: print w/replies, xml ) | Need Help?? |
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 Section
Seekers of Perl Wisdom
|
|