Hi
How do I go about making a perl script print its output as a HTML document
How do I go about making a perl script print its output as a HTML document
#!/C:\Perl\bin
use warnings;
use strict;
print "Content-type: text/html\n\n";
print "<HTML><HEAD>";
print "<TITLE>NAS Disk</TITLE>";
print "</HEAD>";
print "<BODY><H2>Nas Disk capacity</H2>";
# my $data_file = '/perly/nas01.txt';
my $data_file = 'nas01.txt';
open DATA, "$data_file" or die "can't open $data_file $!";
my @array_of_data = <DATA>;
close DATA;
foreach my $line (@array_of_data){
if ($line =~ m/levels/i){
print "$line\n";
}
elsif ($line =~ m/date/i){
print "$line\n";
}
elsif ($line =~ m/hostname/i){
print "$line\n";
}
elsif ($line =~ m/uptime/i){
print "$line\n";
}
}
print "================================================== ==============================<br>\n";
foreach my $line (@array_of_data){
if ($line =~ m/filesystem/i){
print "$line\n";
}
elsif ($line =~ m/SQLsrv/i){
print "$line\n";
}
}
print "================================================== ==============================<br>\n";
foreach my $lines (@array_of_data){
if ($lines =~ m/(\d+)[%]/i){
my $val = $1 ;
print "$lines";
if ($val > 80 ){
print "Please look at this disk immediately\n\n";
}
else {
print "Disk levels are ok\n\n";
}
}
}
print "</html></body>";
Comment