> > Is coding this way wrong? By "this way" I mean where you don't use a > module to write html, but instead do it within the code by using print > "Content-type: text/html", "\n\n"; > > Example program > > #!/usr/bin/perl > > print "Content-type: text/html", "\n\n"; > > open (OMARFILE, "<junk" || die "input file cannot be openned:$!\n"); > > print <<EOF > <html> > <head> > <title>Omar Metrics</title></head> > <body> > <div align=center> > <h1>TSM OMAR STATISTICS</h1> > </div> > EOF > ; > while ( $line =<OMARFILE>) { > chomp($line); > if ($line ne "" ) { > ($fdt,$tod,$cap,$util,$actnodes,$gb,$att,$comp,$comppct,$bdays,$restor > ecnt,$req,$setups) = split(/ /,$line); > > print <<EOF > > <div align=center> > <table border="1" cellspacing="0" cellpadding="0" width="50%"> > <tr> > <td align="center" valign="middle" colspan="2"><b>OMAR Metrics > for $fdt to $tod </b></td> > </tr> > <tr> > <td valign="middle" bgcolor="#00FFFF">Backup Completion > Percentage</td> > EOF > ; > if ($comppct >= 98) { > print <<EOF > <b><td bgcolor=00FF99>$comppct</td></b> > </tr> > <tr> > EOF > ; > } #end if > else { > print <<EOF > <b><td bgcolor=YELLOW>$comppct</td></b> > </tr> > <tr> > EOF > ; > } #end else > print <<EOF > > <td valign="middle" bgcolor="#00FFFF">Total Backup > Attempts</td> > <td><b>$att</b></td> > </tr> > <tr> > <td valign="middle" bgcolor="#00FFFF">Total Backup > Completions</td> > <td><b>$comp</b></td> > </tr> > <tr> > <td valign="middle" bgcolor="#00FFFF">Total Client Disk > Capacity</td> > <td><b>$cap</b></td> > </tr> > <tr> > <td valign="middle" bgcolor="#00FFFF">Total Client Disk > Utilization</td> > <td><b>$util</b></td> > </tr> > <tr> > <td valign="middle" bgcolor="#00FFFF">Total Active Client > Nodes</td> > <td><b>$actnodes</b></td> > </tr> > <tr> > <td valign="middle" bgcolor="#00FFFF">Total Restores</td> > <td><b>$restorecnt</b></td> > </tr> > <tr> > <td valign="middle" bgcolor="#00FFFF">Total Business Days</td> > <td><b>$bdays</b></td> > </tr> > <tr> > <td valign="middle" bgcolor="#00FFF">Gigabytes Written To > Tape</td> > <td><b>$gb</b></td> > </tr> > <tr> > <td valign="middle" bgcolor="#00FFF">Remedy Client > Request</td> > <td><b>$req</b></td> > </tr> > <tr> > <td valign="middle" bgcolor="#00FFF">New Client Setups</td> > <td><b>$setups</b></td> > </tr> > </table> > <br> > </div> > </body> > </html> > > EOF > ; > } #end if > else { > next; > } #end else > > } #end while > close(OMARFILE); > > Sample junk file > > '06/01/2007 00:00' '06/30/2007 23:59' 235 118.75 566 > 43 11 10 98.900 21 204 2 > > '05/01/2007 00:00' '05/31/2007 23:59' 230 113 560 > 41 12,324 12,025 97.500 23 33 21 > > '04/01/2007 00:00' '04/30/2007 23:59' 227 107 552 > 38,807.0 11 11,784 98.300 21 15 24 --------------------------------------------------------
This message w/attachments (message) may be privileged, confidential or proprietary, and if you are not an intended recipient, please notify the sender, do not use or share it and delete it. Unless specifically indicated, this message is not an offer to sell or a solicitation of any investment products or other financial product or service, an official confirmation of any transaction, or an official statement of Merrill Lynch. Subject to applicable law, Merrill Lynch may monitor, review and retain e-communications (EC) traveling through its networks/systems. The laws of the country of each sender/recipient may impact the handling of EC, and EC may be archived, supervised and produced in countries other than the country in which you are located. This message cannot be guaranteed to be secure or error-free. This message is subject to terms available at the following link: http://www.ml.com/e-communications_terms/. By messaging with Merrill Lynch you consent to the foregoing. -------------------------------------------------------- "Please consider the environment before printing this email."
<<inline: RecyclingSymbolGreen.jpg>>